471,627 Members | 1,570 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,627 software developers and data experts.

Compact Framework: Counting lines in a TextBox

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

Feb 3 '06 #1
4 2560
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.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"anoehre" <an*******@gmx.de> wrote in message
news:11********************@z14g2000cwz.googlegrou ps.com...
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

Feb 3 '06 #2
Thanks. But in cpmpact framework there is no lines property.

Feb 3 '06 #3
You can find how to get the number of lines in a CF multi-line TextBox from
the example linked below.
http://blog.opennetcf.org/ayakhnin/P...d-ebe4d28f8b2f

--
Tim Wilson
..NET Compact Framework MVP

"anoehre" <an*******@gmx.de> wrote in message
news:11********************@z14g2000cwz.googlegrou ps.com...
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

Feb 3 '06 #4
Thanks a lot. It works.

Feb 3 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Adam | last post: by
3 posts views Thread by HDB | last post: by
1 post views Thread by Davie | last post: by
6 posts views Thread by =?Utf-8?B?SGFucyAtIERpYUdyYXBoSVQgLQ==?= | last post: by
1 post views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.