Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Here is an example of my code:

 

Dim items() As String

Dim s As String = nreader.ReadToEnd

items = s.Split(New Char() {"|"c})

Dim anItem As String

For Each anItem In items

 

Here is where I am having a problem. I want the split information to show in individual text boxes. I don't know how to make this happen. Any clues?

 

 

Next

 

Thanks!

Mindi

  • *Gurus*
Posted

Are these textboxes already set up?

 

If not, you could initialize, populate and display textboxes on-the-fly in your loop, like so:

 

t = New TextBox()
t.Text = "the text for this item"
t.Location = New Point(100, 100) 'Would have to vary throughout the loop
Controls.Add(t)

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

Posted
Thank you so much for that info. It was really helpful. I have one more question, how would I get this loop to continue to run and create these text boxes on the fly until it has finished reading my text file?
  • *Gurus*
Posted

You posted some code above with the beginning of a loop, I assumed you would put it in that one. Just above that, with the other declarations you would declare t as type textbox, then go through adding them.

 

Something like this, maybe?

 

Dim items() As String
Dim s As String = nreader.ReadToEnd 
items = s.Split(New Char() {"|"c})
Dim anItem As String
Dim t As TextBox

For Each anItem In items
 t = New TextBox()
 t.Text = anItem
 t.Location = New Point(100, 20 * items.IndexOf(anItem)) 'Would have to vary throughout the loop
 Controls.Add(t)
Next

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...