vb.net - How do I "Cancel an event"? -
I have two DateTimePickers dtpDateFrom and dtpDateTo . I have already codified a conditional statement that if I get an error message, I will get an error message earlier than the DTPDTEO DTPDAT, through its value-added event. The change applies. Example:
control in your code where you fail to put your validation in e.cancel = true
private sub dtpDateFrom_Validating (ByVal DtpDateFrom.Validating this form as System.Object, ByVal E System.ComponentModel.CancelEventArgs) as dtpDateFrom. Value & gt; DtpDateTo.Value then messagebox.show ("must be shorter than date") e.Cancel = True 'Validation failed. End if ending sub
Comments
Post a Comment