Check Maximum of Characters of A Line At Multiple Line Textbox.

Hi All,

I want to control user input of a multiple line text box for maximum characters per line.

How could I do it ?

Thank you.
LVL 1
emi_sastraAsked:
Who is Participating?
 
CodeCruiserConnect With a Mentor Commented:
Winforms? Try handling the key up event of textbox, break the text into lines

Dim Lines As String() = txtInput.Text.Split(VBCRLF)

Then check if any of the lines is beyond the maximum then either strip it out show an error

For Each Line In Lines
   If Line.Length > 10 Then
      msgbox "Error"
   End If
End If
0
 
emi_sastraAuthor Commented:
Hi CodeCruiser,

Great.

For Each Line In Lines
   If Line.Length > 10 Then
      msgbox "Error"
   End If
Next

Thank you very much for your help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.