I have a form with a textbox and numerous panels, buttons and other
controls. I have handled the textbox Validating and Validated events. The
textbox will hold a filename. In the validating event, I check that the
string in the textbox is a file that exists or whether or not the string is
blank and display a message box in either case. I also call e.Cancel so
that the value will be corrected.
However, certain buttons on the form (such as a cancel button) I don't want
causing the validation code to run, so I set their CausesValidation
property to False. This has met with limited success. I still get the
validating code executed in situations I don't want it.
Is there a way to find out which control caused the validation to occur? I
only want this for debugging purposes so I can see what controls I have
missed when setting their CausesValidation property. What I am after is
something like the following:
Private Sub txtSourceFile_Validating(...) Handles txtSourceFile.Validating
'Some code here to determine which control caused the
'validating event to occur.
End Sub
Can you think of any other way to get the information I need?
--
Chris
dunawayc[AT]sbcglobal_lunchmeat_[DOT]net
To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.