Agnes,
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 CausesValidation to ensure that they are all valid...
Something like:
For Each control As control In Me.Controls
If control.CausesValidation Then
control.Focus()
If Not Me.Validate() Then
Me.DialogResult = DialogResult.None
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
"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:OF**************@TK2MSFTNGP10.phx.gbl...
As the user input the customercode, I will check the customercode is valid
or not in "validateded event". Well, as the user save the invoice, I would
like to do the validation again.
it seems too dummy that I write another same code about this. Can I
re-user the validated event" ?