Hi,
Do you want to restrict the spaces in text Box?
If so use the below code
Private Sub TextBox1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
If e.KeyCode = Keys.Space Then
e.SuppressKeyPress = True
End If
End Sub
Private Sub TextBox1_KeyUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
TextBox1.Text = TextBox1.Text.Replace(" ", "")
End Sub
kothaisaravan
Junior Poster in Training
51 posts since Oct 2011
Reputation Points: 10
Solved Threads: 2
You can't - or to be exact you can use a dictionary and verify the words between spaces against that, but it's suicidal just to think of it so you can't.
You can count the number of spaces and compare it to the length of the whole string, but you can't be certain if it's been used excessively or the input did infact contain that many spaces.
adam_k
Practically a Posting Shark
803 posts since Jun 2011
Reputation Points: 256
Solved Threads: 149