Hello John,
[color=blue]
> I have a form with a bunch of textboxes. Each text box gets validated
> with the ErrorProvider. I want the form to process something ONLY when
> all the textboxes are valid.
>
> I found a solution, but it seems like a workaround. I'm not sure if
> it's the best way:
>
> Dim ErrorCounter As Integer
>
> Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles btnOK.Click
> If TextBox1.Text = "" Then
> ErrorProvider1.SetError(TextBox1, "Error")
> ErrorCounter += 1
> Else
> ErrorProvider1.SetError(TextBox1, "")
> End If
>
> If TextBox2.Text = "" Then
> ErrorProvider1.SetError(TextBox2, "Error2")
> ErrorCounter += 1
> Else
> ErrorProvider1.SetError(TextBox2, "")
> End If
>
> If ErrorCounter = 0 Then
> 'process code that only happens when there are NO errors
> End If
> End Sub
>
>
> Is this a good way to handle it, or am I missing a better technique?[/color]
I have no better idea _ seems this is OK.
If you are interested have a look at:
http://www.help-info.de/en/Visual_Ba...t.htm#download
HTH
Best regards
Ulrich Kulle
***************************************
http://www.help-info.de
***************************************