General discussion

Locked

VB6: Exit out of a text box's Validation

By vdanner ·
If a user has clicked on the New button, he will be taken to a data entry form. Most of the text boxes have simple validation's in their respective Validation events, such as to make sure they have entered something in required fields. I want the user to be able to, at any time during entering a new record, to change their mind about entering a new record and hit the Cancel button, thereby clearing the form. But I can't get the validation to end if they hit the Cancel button, even if I set CausesValidation = False in the cmdCancel_Click event. It is stuck in the Validation event and won't move on to cmdCancel_Click unless the user enters some dummy data first.

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

VB6: Exit out of a text box's Validation

by Oliver W. In reply to VB6: Exit out of a text b ...

The best solution (and a very clean one too) is to validate the entries only on pressing Save/Ok.
You just have to write a function to verify all fields and returning true if the entries are valid. If one isn't valid, return the field name and senda message to the user to enter the proper values.
Especially when users want to look up special entries in different locations it is annoying to get a NOT VALID message every time.
Validating on OK/save_click is the best solution

hope that helps
Oliver

Collapse -

VB6: Exit out of a text box's Validation

by vdanner In reply to VB6: Exit out of a text b ...
Back to Software Forum
2 total posts (Page 1 of 1)  

Software Forums