T
Tom
How is the best way to avoid validation when closing a
window? For instance, I have a Windows Forms window which
has a validation event for a text box. However, if one
enters invalid data in then and then attempts to close the
window (either via my custom 'Close' box or by clicking the
close 'X' in the upper right window corner), the validation
event still triggers and it tells the user that they have
invalid data. Which of course means they need to clear that
data out then close the window.
Sure, I could trap the close event (both in my custom CLOSE
box and also via WndProc), set a form level 'Closing'
variable and check that in my validate code, but there has
GOT to be an easier way. Why does Windows insist on firing
the validate event when a window is closing?
Is there no easier way to avoid the Validate event when
closing? Thanks.
Tom
--
window? For instance, I have a Windows Forms window which
has a validation event for a text box. However, if one
enters invalid data in then and then attempts to close the
window (either via my custom 'Close' box or by clicking the
close 'X' in the upper right window corner), the validation
event still triggers and it tells the user that they have
invalid data. Which of course means they need to clear that
data out then close the window.
Sure, I could trap the close event (both in my custom CLOSE
box and also via WndProc), set a form level 'Closing'
variable and check that in my validate code, but there has
GOT to be an easier way. Why does Windows insist on firing
the validate event when a window is closing?
Is there no easier way to avoid the Validate event when
closing? Thanks.
Tom
--