this is my vb program. I want to be able to write only numeric charaters in
the textfield. If I do enter a alphanumeric charater I want either a error
message to open or nothing to happen at all. I already have able to get numeric charaters but every time I enter a alphanumeric charater it gives a run time error. I dont a run time error to come. I want message box to come up.
Private Sub Addbut_Click()
Dim tnum1 As Integer
Dim tnum2 As Integer
Dim tnum3 As Integer
tnum1 = CInt(Text1.Text)
tnum2 = CInt(Text2.Text)
tnum3 = CInt(Text3.Text)
tnum3 = CInt(Text1.Text) + CInt(Text2.Text)
End Sub
Private Sub Text1_Change()
Dim Num1 As String
Dim num As Integer
'num = CInt(Text1.Text)
If num = CInt(Text1.Text) Then
MsgBox "error"
End If
End Sub
Function characters(topchar As String) As Data
Dim alpha As Long
alpha = "1"
topchar = Chr(alpha)
End Function
Private Sub Text2_Change()
Dim Num1 As String
Dim num As Integer
num = CInt(Text2.Text)
End Sub
Private Sub Text3_Change()
Dim Num1 As String
Dim num As Integer
'num = CInt(Text3.Text)
End Sub
Enter your message below
Sign in or Join us (it's free).