I want to count the number of lines needed for VB multiline textbox to display the whole given string. So that I can increase height of the textbox accordingly during TextChanged event.
Vb.net – Count number of lines in VB multiline textbox
countlinestextboxvb.net
Related Topic
- Python – Count the number of occurrences of a character in a string
- Javascript – How to detect a textbox’s content has changed
- Python – How to count the occurrences of a list item
- Wpf – Multiline for WPF TextBox
- Find duplicate lines in a file and count how many time each line was duplicated
- Wpf – Multiline Textbox with automatic vertical scroll
Best Answer
The
TextBox
has aLines
property.Then you have just one line. Lines are separated by Ènvironment.NewLine (VBCrlf). Your text looks like it would have multiple lines but actually it is just wrapped since it's too long for the view.
Try to set the height in
TextChanged
in this way: