PDA

Click to See Complete Forum and Search --> : How to force controls to validate?


brandoom
Jul 13th, 2006, 07:05 PM
Is there a method I can call that will force all my textbox controls to fire their Validating event? -or- do I have to call all those events manually? The textboxes are not bound to a datasource. If I have to call them manually, what's the best way to do that in C#?

I'm actually doing .NET Compact Framework if it matters.

jmcilhinney
Jul 13th, 2006, 08:06 PM
There's no such thing as calling events manually. An event is an event and it is raised by the object itself. Controls will generally be validated when an attempt to remove focus from them is made. You can call a Form's Validate method to validate every control it contains at any time. You can also call the ValidateChildren method of the form or any container or user control.

brandoom
Jul 13th, 2006, 08:07 PM
Thanks...

I just figured out that a form.Focus() also works.