Norton,
I got the following tip from "Windows Forms Programming in C#" by Chris
Sells, from Addison Wesley.
Within your "Accept" button click handler (the "save" button) process each
control that CausesValidatio n to ensure that they are all valid...
Something like:
For Each control As control In Me.Controls
If control.CausesV alidation Then
control.Focus()
If Not Me.Validate() Then
Me.DialogResult = DialogResult.No ne
Exit For
End If
End If
Next
Note this version does not validate controls nested within other container
controls, such as GroupBoxes, I would include the above in a recursive
subroutine.
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...
Hope this helps
Jay
"norton" <no********@hot mail.com> wrote in message
news:eB******** *****@tk2msftng p13.phx.gbl...
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