i have created a textbox, and if the user have enter an invalid value, the textbox must be able to check whether the value enter by the user is a string or an integer. I have set the CausesValidation to true. If i tried to enter a character, and the msgbox should appear "Is not an integer" but instead i got an error message that says "compile error : Method or data member not found " . I doesn't understand why does this error message keep pop out. Please explain where it went wrong.

Private Sub Text2_Validate(Index As Integer, Cancel As Boolean)

    If IsNumeric(Text2.Text) = False Then
        MsgBox "Is not an integer"
        Cancel = True
        
    End If

End Sub

Private Sub Command1_Click()

    If IsNumeric(Text1.Text) = False Then
        MsgBox "Is not an integer"
        Exit Sub
    End If

    MsgBox "Ok"

End Sub

pG