944,144 Members | Top Members by Rank

Ad:
May 2nd, 2006
0

Validation function

Expand Post »
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
Similar Threads
Reputation Points: 13
Solved Threads: 0
Light Poster
k_en is offline Offline
35 posts
since Jul 2005
May 2nd, 2006
0

Re: Validation function

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Sub Command1_Click()
  2.  
  3. If IsNumeric(Text1.Text) = False Then
  4. MsgBox "Is not an integer"
  5. Exit Sub
  6. End If
  7.  
  8. MsgBox "Ok"
  9.  
  10. End Sub



pG
Reputation Points: 24
Solved Threads: 6
Junior Poster in Training
purplegerbil is offline Offline
78 posts
since Apr 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: TMP files...
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: how I chang radio button selection ?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC