views:

26

answers:

2

What's the best way to read in a the contents of a textbox line by line in VB.net 2.0?

I'm currently using the one listed at TextBoxBase.Lines Property at MSDN but wanted to know what other ways could one read in a textbox line by line in VB.net.

A: 

It might not be the best way, but you could always use textbox.Text.Split(vbnewline), which will return an array of string. You could use that in a for each loop

For each strLine as string in textbox.text.split(vbnewline)
...
end for
David Brunelle
+1  A: 

The Lines property is what you want to use. Parsing the Text property yourself requires more code and doesn't make it faster. Write a better question if you have a reason to look for an alternative.

Hans Passant
Was just checking to see if there was a better alternative...it seems not though...thanks.