2
It has how to make a field of one textbox only receive integer values?
2
It has how to make a field of one textbox only receive integer values?
2
At the event Change of Textbox, check if the entered value is number, if it is not then assign the old value.
Dim textval As String
Dim numval As String
Private Sub TextBox1_Change()
textval = TextBox1.Text
If IsNumeric(textval) Then
numval = textval
Else
TextBox1.Text = CStr(numval)
End If
End Sub
0
At the event KeyPress of your Textbox add the following check:
Private Sub TextBox1_KeyPress(KeyAscii As Integer)
if not IsNumeric(Chr$(KeyAscii)) then
KeyAscii= 0
exit sub
end if
End Sub
Browser other questions tagged visual-basic-6
You are not signed in. Login or sign up in order to post.
ASP.NET, Windows Forms, or WCF?
– Oralista de Sistemas