Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Loop through textbox
#1
VB section is falling asleep. So I thought I'd post this simple code. I did a search and didnt find anything already so here it is.


This code will loop through each line of a textbox. This is useful if you want to number the lines or something of that nature.
Code:
For Each line As String In TextBox1.Lines
    MessageBox.Show(line)
  Next

I used to split the texbox like this, but the code above seems to work better.
Code:
Dim str As String() = TextBox1.Text.Split(Environment.NewLine)
  For Each s As String In str
    MessageBox.Show(s)
  Next
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  how to display google captcha picture on form and add to textbox hit ok to bypass polas 0 1,265 09-14-2012, 01:59 PM
Last Post: polas
  [Release] TextBox Color Changer [Release] Resistance 23 6,966 10-14-2011, 02:55 PM
Last Post: Resistance
  How to set a textbox's value [VB] James Ford 10 2,207 09-01-2011, 02:15 AM
Last Post: James Ford
  [TuT] How to Make The Checkbox Fill in Textbox's [VB] Deceive 2 1,543 08-04-2011, 04:46 AM
Last Post: Arron XR
  {Noob Proof} Get text from a Website to a Textbox {TuT} iCrack 3 1,504 06-20-2011, 09:07 PM
Last Post: LulzBoat

Forum Jump:


Users browsing this thread: 1 Guest(s)