Advertisement

05.13.2008 at 11:02PM PDT, ID: 23400395
[x]
Attachment Details

How to validate user input on selected controls

Asked by PantoffelSlippers in Microsoft Visual Basic.Net, .NET, .NET Framework 2.0

Tags: VB.Net, Framework 2.0, Validation,Validate,Validating

Hi Experts,

I have a small form on which a user captures data.  I need to validate the input of several text boxes ....

In the Validting event of each textbox I have the code that validates the input of that textbox.  If validation (according to my logic) fails, I display a nice error provider control next to the applicable textbox.  

Now I want to perform a validation on each control manually when the user clicks OK.  I have these text boxes all on a panel to make iteraing through them easy.  I wish to loop through these text boxes and force the Validating event on each of them.

How do I achieve this?

I've tried the following which doesn't work:

    Private Sub ValidateInput()   'I get called when the user clicks OK
        Dim XControl As Control

        For Each XControl In Me.pnlValidateInputOnMe.Controls
            XControl.Invalidate()
            XControl.Update()
        Next

        Me.Refresh()
End Sub

Please assist

ThanksStart Free Trial
 
Loading Advertisement...
 
[+][-]05.13.2008 at 11:12PM PDT, ID: 21561609

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Microsoft Visual Basic.Net, .NET, .NET Framework 2.0
Tags: VB.Net, Framework 2.0, Validation,Validate,Validating
Sign Up Now!
Solution Provided By: Dhaest
Participating Experts: 1
Solution Grade: B
 
 
[+][-]05.13.2008 at 11:33PM PDT, ID: 21561671

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.13.2008 at 11:36PM PDT, ID: 21561683

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]05.13.2008 at 11:43PM PDT, ID: 21561710

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.13.2008 at 11:49PM PDT, ID: 21561726

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.13.2008 at 11:55PM PDT, ID: 21561744

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.14.2008 at 12:01AM PDT, ID: 21561757

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.14.2008 at 12:03AM PDT, ID: 21561766

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.14.2008 at 12:04AM PDT, ID: 21561771

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628