J
John Richardson
General question about how WinForms handles undoing a change during a
control's validation, if it does at all.
After a change to a control's value, if the data is determined to be
invalid, then in the control's Validating event handler, setting e.Cancel =
true will prevent the offending control from losing focus until the data in
the control is good.
If the user wants to revert to the original data, say by hitting ESC, does
the form have any kinds of default behaviours for this kind of action (ie:
undoing a change)? Or do I have to program this whole undo process
manually?
This could entail overriding the ProcessCmdKey and looking for ESC, and
storing the value of the control before the control receives focus so I can
reset it after ESC is hit.
I had thought that this was a default behaviour for some reason, but testing
this out reveals this not to be the case for my TextBox.
Are there any suggestions for a better way to implement a simple undo?
control's validation, if it does at all.
After a change to a control's value, if the data is determined to be
invalid, then in the control's Validating event handler, setting e.Cancel =
true will prevent the offending control from losing focus until the data in
the control is good.
If the user wants to revert to the original data, say by hitting ESC, does
the form have any kinds of default behaviours for this kind of action (ie:
undoing a change)? Or do I have to program this whole undo process
manually?
This could entail overriding the ProcessCmdKey and looking for ESC, and
storing the value of the control before the control receives focus so I can
reset it after ESC is hit.
I had thought that this was a default behaviour for some reason, but testing
this out reveals this not to be the case for my TextBox.
Are there any suggestions for a better way to implement a simple undo?