>I usually verify each field after user entry by writing the logic in the VALID event.
>
>If the user decides to click the EXIT button, while the cursor and focus is on a field with a VALID event, the Valid event logic is executed before the focus goes to the EXIT button.
>
>Does anyone have a good way of bypassing this logic? Maybe by checking at the top of the VALID logic for some occurence that the EXIT button click caused?
Some alternatives are:
1) Put all the control logic in the Form.Save() method. Personally, I prefer this solution, since: a. it solves this particular problem, b. some values in different fields might be interdependent. And it is very easy to program.
2) Put the "Save" and "Cancel" commands in buttons in a ToolBar - outside the form. Thus, no TextBox.Valid() will be executed.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)