I'm trying to use validating event handler to check if the user is inputting the correct data but
when i use the
ErrorProvider1
or
IsNumberInRange
I'm not sure how to declare or Call them
can anyone help here is the code
problem 1
Private Sub txtNumber_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtNumber.Validating
'See if the text is 10 digits
If Not (txtNumber.Text Like "###-###-####") Then
'The phone number is not valid
'Cancel the event moving off of the control
e.Cancel = True
'select the offending text
txtNumber.Select(0, txtNumber.Text.Length)
'Give the ErrorProvider the error message to display
ErrorProvider1.SetError(txtNumber, "Invalid Phone Number" & "Format")
End If
Problem 2
Dim IsStringInRange As Text' what do i put here to make this work?
Private Sub txtFirst_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtFirst.Validating
txtFirst.Text = StrConv(txtFirst.Text, VbStrConv.ProperCase)
If IsStringInRange(txtFirst.Text, 1, 20) Then
lblInvalidFirstName.Visible = False
Else
lblInvalidFirstName.Visible = True
End If
End Sub
when i use the
ErrorProvider1
or
IsNumberInRange
I'm not sure how to declare or Call them
can anyone help here is the code
problem 1
Private Sub txtNumber_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtNumber.Validating
'See if the text is 10 digits
If Not (txtNumber.Text Like "###-###-####") Then
'The phone number is not valid
'Cancel the event moving off of the control
e.Cancel = True
'select the offending text
txtNumber.Select(0, txtNumber.Text.Length)
'Give the ErrorProvider the error message to display
ErrorProvider1.SetError(txtNumber, "Invalid Phone Number" & "Format")
End If
Problem 2
Dim IsStringInRange As Text' what do i put here to make this work?
Private Sub txtFirst_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtFirst.Validating
txtFirst.Text = StrConv(txtFirst.Text, VbStrConv.ProperCase)
If IsStringInRange(txtFirst.Text, 1, 20) Then
lblInvalidFirstName.Visible = False
Else
lblInvalidFirstName.Visible = True
End If
End Sub