Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Variable textboxes

Status
Not open for further replies.

sicohne

Technical User
Jun 30, 2003
51
GB
I have 5 textboxes (textbox1 - textbox5).
I have a text file with 5 lines of data

I want to write a loop which will put each line into the coresponding textbox. I.e.

for i = 1 to 5
lineOfText = LineInput(1)
textbox(i).text = lineOfText
next

The above example doesn't work, but is there anyway of doing this or do I have to tell each line specifically which textbox to go in?
 
VB.NET does not support VB6 style control arrays which is what you are attempting to do here. Instead you need to create your own array of textbox controls in the constructor after the call to InitializeComponents.

You can then use the code that you have given.
 
Thanks, I managed it with a controls collection in the end.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top