Donot allow any space in textbox [Resolved]

Posted by Kundan under VB.NET on 7/28/2013 | Points: 10 | Views : 5300 | Status : [Member] | Replies : 3
Suppose iam entering some integer values in textbox .It will not allow any space in the textbox.


Thanks in advance




Responses

Posted by: Satyapriyanayak on: 7/28/2013 [Member] [MVP] Silver | Points: 50

Up
0
Down

Resolved
Public Class Form1


Private Sub TextBox1_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If e.KeyChar = " " Then
e.Handled = True
End If
End Sub
End Class


If this post helps you mark it as answer
Thanks

Kundan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ssj_Kumar on: 7/28/2013 [Member] Starter | Points: 25

Up
0
Down
try with
string.IsNullOrWhiteSpace(TextBox1.Text)
Do this is TextBox.TextChanged Event.


Regards,
Jayakumar Selvakani

Kundan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kundan on: 7/28/2013 [Member] Starter | Points: 25

Up
0
Down
Hi Jitendra,

It is a windows application.

Hi Ssj,

It is showing error as

IsNullOrWhiteSpace is not a member of string




Kundan, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response