vb.net - How do I "Cancel an event"? -


itemprop = "text">

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:

  1. dtpDateFrom = 2 July
  2. dtpDateTo = July 3rd
  3. If I DtpDateFrom on 4th of July> error message + without altering July 4

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

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -