943,746 Members | Top Members by Rank

Ad:
Aug 10th, 2008
0

Textboxes

Expand Post »
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?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
breezyy is offline Offline
9 posts
since Aug 2008
Aug 10th, 2008
0

Re: Textboxes

use if end if or case statement.
if check1.value = 1 then
text1.text = hi
else
text1.text= ""
end if
Reputation Points: 14
Solved Threads: 78
Practically a Posting Shark
abu taher is offline Offline
835 posts
since Jul 2008
Aug 11th, 2008
0

Re: Textboxes

Hi,

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

vb Syntax (Toggle Plain Text)
  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
Reputation Points: 84
Solved Threads: 140
Posting Shark
QVeen72 is offline Offline
923 posts
since Nov 2006
Aug 11th, 2008
0

Re: Textboxes

Click to Expand / Collapse  Quote originally posted by QVeen72 ...
Hi,

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

vb Syntax (Toggle Plain Text)
  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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
breezyy is offline Offline
9 posts
since Aug 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Bar code scanner
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: how to display a picture from "C:\" in picturebox1





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC