Vb validating event

You can also choose to save data or stop whatever action is causing the event to occur and substitute a different action.

A programmer can evaluate the state of the data at that point and react to any error in the data either by: Listing 5.4 illustrates the use of the Validate event procedure to perform validation and to decide whether or not to keep focus on the current control.

LISTING 5.4 USING THE VALIDATE EVENT PROCEDURE Private Sub txt Age_Validate(Cancel As Boolean) If Not Is Numeric(txt Age.

NET textbox, which event handler is better to use: Validating or Leave?

The above code will cause the Validating event for each of your controls to be raised, ensuring that all the controls get validated, before the dialog is closed or the data is saved...

None Exit For End If End If Next Note this version does not validate controls nested within other container controls, such as Group Boxes, I would include the above in a recursive subroutine.

Hi All, I am writing a simple win form which contains a button, when user click the button i want to validate all the other textbox and see if there is anything goes wrong may i know how can i trigger the validating event for all text box? thx and regard,s Norton Norton, It sounds for me as a horse behind the car.

You must have an account to comment. Please register or login here!