0
0to60
I have, for example, a combobox on a form. If the user types in some
nonexistant customer into the combobox and leaves the field, I have the
Validate event notify the user of the bad customer and return the focus to
the form. Pretty basic stuff, and its all running nicely. Now, I would
like the user to be able to hit the X button (or select "close" from the
system menu) but NOT have to deal with the validation code. Like, maybe
they just want to get out of the form without further ado. I have tried
everything under the sun, but Validate is not to be denied!!
I've tried messing around with comboBox.CausesValidation and
form.CausesValidation, but it didn't work.
I overloaded WndProc and handled the WM_CLOSE message by setting
comboBox.CausesValidation = false but to no avail.
I overloaded WndProc and handled WM_SYSCOMMAND where wParam = SC_CLOSE and
set comboBox.CausesValidation = false but no dice.
I overloaded WndProc and handled WM_NCLBUTTONDOWN where wParam = 20 (that's
the user clicking on the X button) and setting comboBox.CausesValidation =
false, it did absolutely nothing.
Is there any way to bypass validation when the user closes the form? It
seems like signing up for Validation is a deal with devil. There's no
getting out of it.
nonexistant customer into the combobox and leaves the field, I have the
Validate event notify the user of the bad customer and return the focus to
the form. Pretty basic stuff, and its all running nicely. Now, I would
like the user to be able to hit the X button (or select "close" from the
system menu) but NOT have to deal with the validation code. Like, maybe
they just want to get out of the form without further ado. I have tried
everything under the sun, but Validate is not to be denied!!
I've tried messing around with comboBox.CausesValidation and
form.CausesValidation, but it didn't work.
I overloaded WndProc and handled the WM_CLOSE message by setting
comboBox.CausesValidation = false but to no avail.
I overloaded WndProc and handled WM_SYSCOMMAND where wParam = SC_CLOSE and
set comboBox.CausesValidation = false but no dice.
I overloaded WndProc and handled WM_NCLBUTTONDOWN where wParam = 20 (that's
the user clicking on the X button) and setting comboBox.CausesValidation =
false, it did absolutely nothing.
Is there any way to bypass validation when the user closes the form? It
seems like signing up for Validation is a deal with devil. There's no
getting out of it.