The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
Some body know how to count the no of lines in a textbox in VB.Net?
A "line" is defined as each new line after a word-wrap, in other words, each line showing against the left margin. It does not mean, and is independent of, the actual number of lines delimited by hard returns in the text.
CBClay Burch Syncfusion Team July 4, 2002 09:47 AM UTC
With a TextBox, other than trying to implement a wordwrap algorithm yourself, and count the wraps in the process, I don't know of a way to get this value.
If you use a RichTextBox, you can probably use its GetPositionFromCharIndex to compute the number of wrapped lines. Worst scenario is you could do a loop from 1 to Length of the string and just count the number of times the Y index changed. More efficient might be to get the difference between the Y of the last character and the Y of the first character and then divide by the row height.
this.label1.Text = this.richTextBox1.GetPositionFromCharIndex(
this.richTextBox1.Text.Length).ToString();
this.label1.Refresh();
ANAnonymousJuly 4, 2002 09:13 PM UTC
Thanks Clay
ANAnonymousJuly 4, 2002 09:15 PM UTC
Thanks Clay
ANAnonymousJuly 4, 2002 09:15 PM UTC
Thanks Clay
ADAdministrator Syncfusion Team July 7, 2002 11:03 PM UTC
> With a TextBox, other than trying to implement a wordwrap algorithm yourself, and count the wraps in the process, I don't know of a way to get this value.
Could you use Graphics.MeasureString()?