Results 1 to 3 of 3

Thread: How to force controls to validate?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2002
    Posts
    196

    How to force controls to validate?

    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.
    Brandon S Davids

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: How to force controls to validate?

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Dec 2002
    Posts
    196

    Re: How to force controls to validate?

    Thanks...

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width