V
V
Vimake2014-01-07 18:21:53
C++ / C#
Vimake, 2014-01-07 18:21:53

How to count the number of lines in a textbox?

I'm trying to count the number of lines in a text-box and display it in a lable
label9.Text = textBox2.Lines.Length;, but it says an error that it's impossible to convert int to string

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Z
Zaic 1024, 2014-01-07
@Vimake

label9.Text = textBox2.Lines.Length.ToString();
or

label9.Text = Convert.ToString(textBox2.Lines.Length);

A
AlexP11223, 2014-01-07
@AlexP11223

:facepalm: :rtfm: .ToString
() though.
And yes, give the elements meaningful names, not textbox98 and btn56.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question