|
-
Jan 28th, 2007, 09:46 AM
#1
Thread Starter
Junior Member
data entry into textbox
hi,
how do i allow only numbers or null allowed to be entered into a textbox?
-
Jan 28th, 2007, 12:28 PM
#2
Re: data entry into textbox
Search the forum. You will find loads of responses to this question.
-
Jan 28th, 2007, 03:18 PM
#3
Hyperactive Member
Re: data entry into textbox
This will only allow numbers to be entered.
VB Code:
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If Not Char.IsNumber(e.KeyChar) Then
e.Handled = True
End If
End Sub
If my post helps , please feel free to rate it 
-
Jan 28th, 2007, 03:38 PM
#4
Addicted Member
Re: data entry into textbox
You should also allow the backspace key to be pressed.
VB Code:
If Char.IsNumber(e.KeyChar) = False And Asc(e.KeyChar) <> 8 Then
e.Handled = True
End If
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|