I have programmed a sub procedure that will be called in the main procedure (called by mainForm event), to validate the inputs before the main calculation. Now I’m searching for a way to cancel the calculation and refocus the mainForm if some inputs are mismatched. I think it’s unnecessary to use the Try-Catch statement to trap the error from calculation because I know its source and it should be prevented for the sake of code performance. Does someone have a solution this?
I have programmed a sub procedure that will be called in the main procedure
Share
If you want to leave a subroutine early you just need to say
Return.Edit.
It sounds like you’re calling a method that calls another method. Have the second method return a Boolean indicating whether the input is valid. Something like this: