Compact Framework: Counting lines in a TextBox

A

anoehre

Hi!

I have a multi-line text box in a compact framework c# application. I
need a method to calculate the excact number of lines of the textbox
and a method to calculate the number of used lines after the text box
was filled with a string.

Any ideas?

Greetings,
Arne
 
N

Nicholas Paldino [.NET/C# MVP]

Arne,

The easiest way I can see is to access the Lines property. This will
expose an array of strings. Once you do that, you can use the Length
property of the array to determine the number of lines.

However, this might be very inefficient as the number of lines
increases, since it involves some work on the control's part to determine
the lines.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top