Information générale
Titre:
Validating Ocx control
Versions des environnements
i need to validate an ocx control which has a "validar" method that returns true or false, if i trie to validate from validating's event of the control it ignores the validation and allows to leave the control with invalid data, if i move the code to a button and in that case it performs the validation,here is my code.
thank's in advance
'this code does not work i can leave control with invalida data
Private Sub txtcuit_Validating(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles txtcuit.Validating
If Me.txtcuit.Validar = False Then
MsgBox("error")
e.Cancel = True
End If
End Sub
'This code works it detects invalid data and send back to the control
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
If Me.txtcuit.Validar = False Then
MsgBox("error")
Me.txtcuit.focus()
End If
End Sub
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement