By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,374 Members | 1,768 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,374 IT Pros & Developers. It's quick & easy.

VB6 Contents for text into label

100+
P: 104
Hi there and a happy new year to all. I have a label and a few text boxes. The label is set to scroll the info from the textboxes. It is easy to link 1 textbox to a label, but I want to label to read from a few textboxes in sequence. and scroll the info from those text boxes.

Herewith my code:
frmSplash.Label50.Caption = Player1.Text1.Text Then Player1.Text2.Text

My problem is how to identify the next "textbox" in the sequence? I have used the Then function as i have no idea what should be used or if it is possible. I have tried "then" "," "next" between the 2 identified textboxes with no luck. Can anyone help please.

Thanks
Werner
Jan 1 '08 #1
Share this Question
Share on Google+
4 Replies


QVeen72
Expert 100+
P: 1,445
Hi,

Keep an Array which contains names of all the TextBox in a Sequential manner, Say MyArr(0) = "Text1", MyArr(1) = "NewTextBox"..
And a Form Level Variable, To Check the Current Index.
So depending on the Index, Set the Next TextBox,
To Go to Next TextBox :

Expand|Select|Wrap|Line Numbers
  1. Dim T1 As TextBox
  2. MyIndex = MyIndex+1
  3. If MyIndex >= UBound(MyArr) Then MyIndex =0    'Repeat here
  4. Set T1 = MyArr(MyIndex)...
  5. ' Write here code to populate from T1
  6.  
Regards
Veena
Jan 1 '08 #2

Expert 5K+
P: 8,434
... frmSplash.Label50.Caption = Player1.Text1.Text Then Player1.Text2.Text

My problem is how to identify the next "textbox" in the sequence? I have used the Then function as i have no idea what should be used or if it is possible. I have tried "then" "," "next" between the 2 identified textboxes with no luck. Can anyone help please.
You use "&" or "+" to concatenate them into a single string.

Then is not a function. It is the part of the If statement which indicates what to run if the condition is true.
Jan 1 '08 #3

100+
P: 104
Thanks Killer42, that was the simple answer i was looking for, just another question to that. My result is working perfectly, but obviously now reads like this : MarkJohn How do I indentify spaces example Mark John. Thanks again

My code :
frmSplash.Label50.Caption = Player1.Text1.Text & Player1.Text2.Text
Jan 1 '08 #4

Expert 5K+
P: 8,434
Just keep in mind, you can use & to concatenate any strings, including spaces or whatever you want.
Jan 2 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.