"Hamed" <ha***@raymehr.comwrote in message
news:O$**************@TK2MSFTNGP02.phx.gbl...
The Validating event of the first form is fired twice not the second form.
Well, you should still be able to set some kind of flag there too. Maybe
some flag in a Global scope.
It's the same thing with having Textbox_Change event firer on a Form_load
where you have code in the TextBox_Change event, and you only want the code
in the event to executed when the user changes data in the Textbox.
You don't want the Textbox_Change event to firer on the Form_Load and
execute code because you populated default data in the TextBox.Text =
"MM/DD/YYYY", as an example for display purpose, which will make the
Textbox_Change event firer and code executed if you do bypass it during the
Form_Load.
You simply avoid the situation by setting a gbBoolen flag to true to make it
bypass the code in the Event and set it to false at the end of the Form_Load
to make the event execute the code when it's fired due to the user changing
data in the TextBox.
It's the same principles here. You know the conditions as to when this is
happening so set a Global Boolean flag, if you must, to true and bypass
code execution and set it to false when the method is exited.