Question Checking one procedure before running another.

Anton75

New member
Joined
Mar 28, 2014
Messages
2
Programming Experience
Beginner
Hi everyone, I'm a newbie to Programming so hopefully this will be an easy one ;-)

I am completing a Windows form assignment (which is due in 48 hours!) and I basically need the following to occur.

I have one procedure that adds together whatever numbers are placed into text boxes (simple enough) yet first, it is supposed to check a separate validation procedure (which I have successfully written) to see if the text boxes have any invalid characters.

If the textboxes have invalid characters it is supposed to stop the adding procedure and show the validation procedure, if it has all valid characters the adding procedure can run.

I believe I am supposed to have the validation procedure pass on some kind of Boolean operation or something, please let me know if more info is needed, if anyone can help me that would be awesome!!
 
Your method that does the validation should be a Function that returns a Boolean. If the input passes validation you return True and if it fails you return False. You then use a If statement to call your validation method and you call your calculation method inside the If block, so it only gets called if the validation succeeds.
 

Latest posts

Back
Top