Rahul Patel

Rahul Patel

  • NA
  • 1
  • 1.2k

Validation Checks

Dec 18 2012 9:58 AM
Hi guys,

I have a series of validation checks that i need to complete in order to be able to save a record. I wanted to do this in the way below.


public
override void SaveRecord()

   NameCheck();
   PostcodeCheck();
   SaveRecord();
}


As you can tell, even if the checks are not met, it still goes through the next method. However, i want the method to stop as soon as it does not fulfill the validation check.

The check in the 'NameCheck' method is if the user does not input a name, then the program displays an error box and does not save the record. The 'PostcodeCheck' is there to ensure that there are no duplicates of the same postcode.

Is this possible?

Kindest Regards,

Rahul Patel



Answers (1)