Question Counting Lines in a Textbox

kite

New member
Joined
Nov 12, 2008
Messages
4
Programming Experience
Beginner
Hello,

I just wondering how I can count the number of lines in a textbox? On each line is a filename and I have to display in a label the number of files displayed in the textbox.

I found a mention of the ListCount property but it doesn't work for me (i'm using Visual Studio 2005)

Thanks
 
If you go to the lines property for the textbox you'll see that it's an array of strings. Just like other arrays you can use the length to determine how many elements are in it.

VB.NET:
Dim i As Integer = Me.TextBox1.Lines.Length

Best of luck in your learning.
 
Back
Top