Textboxes

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Aug 2008
Posts: 9
Reputation: breezyy is an unknown quantity at this point 
Solved Threads: 0
breezyy breezyy is offline Offline
Newbie Poster

Textboxes

 
0
  #1
Aug 10th, 2008
Hey there,
I have the following problem driving me nuts!
I have 2 check boxes and each one is assigned a message (for check 1 say Hi, for check 2 say food). If I click on one of them, it displays its message in a text box, and pressing the second one, (with the 1st one still ticked) should display both messages. Problem is, one is overwriting the other, and vice-versa. Any tips?
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 498
Reputation: abu taher is an unknown quantity at this point 
Solved Threads: 25
abu taher's Avatar
abu taher abu taher is offline Offline
Posting Pro in Training

Re: Textboxes

 
0
  #2
Aug 10th, 2008
use if end if or case statement.
if check1.value = 1 then
text1.text = hi
else
text1.text= ""
end if
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: Textboxes

 
0
  #3
Aug 11th, 2008
Hi,

You need to build the message string accordingly..
Try This :

  1. Dim T As String
  2. T= ""
  3. If chk1.Value = vbChecked Then
  4. T = "Hi "
  5. End If
  6. If chk2.Value = vbChecked Then
  7. T = T & " Food "
  8. End If
  9.  
  10. MsgBox T

Regards
Veena
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 9
Reputation: breezyy is an unknown quantity at this point 
Solved Threads: 0
breezyy breezyy is offline Offline
Newbie Poster

Re: Textboxes

 
0
  #4
Aug 11th, 2008
Originally Posted by QVeen72 View Post
Hi,

You need to build the message string accordingly..
Try This :

  1. Dim T As String
  2. T= ""
  3. If chk1.Value = vbChecked Then
  4. T = "Hi "
  5. End If
  6. If chk2.Value = vbChecked Then
  7. T = T & " Food "
  8. End If
  9.  
  10. MsgBox T

Regards
Veena

That was a real life saver!
In fact the error I made was using T = T And " Food " instead of T = T & " Food "
Thanks for the tip !
Cheers
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 600 | Replies: 3
Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC