Changes

Event Sequences in Visual Basic VB6

1,719 bytes added, 00:05, 15 February 2008
The following lines were added (+) and removed (-):
== Event Table == == New Validation Event in VB6 ==Visual Basic 6.0 added a new Validate event and CausesValidation property to aid in field-by-field validation. To use the new Validate event, set the CausesValidation property to True for each field that could receive focus, which luckily is the default value for that property. As you leave a field, the Validate event is then generated before any of the focus events (such as LostFocus) are generated. This allows you to validate the data before actually losing focus from the field.If you want to have a field on the form that the user can select without going through any validation, you can set the CausesValidation property to False for that field. For example, if you have a Help or Cancel button, you want to allow the user to select the button without having the current field validated. So set the CausesValidation property for the Help or Cancel button to False. When the user leaves a field and clicks the Help button, the user will be able to view the help without first validating the field.The Validate event has a Cancel parameter. You can set this parameter to True if you want to keep focus on the field that is in error. Alternatively, you can set the Cancel parameter to False (the default) if you want to allow the end-user to continue entering data without immediately correcting the problem.You may want to use the Validate event without using the Cancel parameter. If an error occurs during validation, you can set the field’s Forecolor property to red and modify the ToolTipText property to display the specific error message for that field. That tells the user something is wrong without interrupting the data entry flow.
Bureaucrat, administrator
16,192
edits