S
Samuel Shulman
Is there any way to put a limit on the number of lines in a textbox? (appart
of number of characters)
Thank you,
Samuel
of number of characters)
Thank you,
Samuel
Michel Posseth said:count the number of occurences of environment.newline and take the action
you want to perform
here a small example that could do something after you have more as 5 rows
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox1.TextChanged
If countsubstrings(TextBox1.Text, Environment.NewLine) = 5 Then
'do your stuff
End If
End Sub
Function countsubstrings(ByVal source As String, ByVal search As String)As
Integer
Dim count As Integer = -1
Dim index As Integer = -1
Do
count += 1
index = source.IndexOf(search, index + 1)
Loop Until index < 0
Return count
End Function
hope to have given you some inspiration
regards
Michel Posseth [MCP]
Samuel Shulman said:Is there any way to put a limit on the number of lines in a textbox?
(appart of number of characters)
Thank you,
Samuel
Stuart said:doesn't return .count
nor can you use Ubounds