Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error Provider Question... 1

Status
Not open for further replies.

sqlsamurai

Programmer
Joined
May 11, 2005
Messages
120
Location
US
I have a couple of error providers on my form and i noticed the other day they were showing up in the property page of just about every control on the form.

Can anybody explain why that happens?

I have included a screen shot to better illustrate what i am trying to say. Notice that i have two buttons, a combo box, and two error providers. BOTH error providers show up in the property page for button 2. Button 1 and Combobox1 are the same.

What i assume to understand from this is that i could use the SAME error provider for every control on the form, but only one at a time, right? I couldnt display two different errors using the same error provider, right?

epques.jpg
 
Ha!

You can have only one errorProvider and apply it to any control at the same time. You can setError with different messages, different icons+alignment... , different everything.

Here issomething of my program:



Private Sub VtxtJob_Validated(ByVal sender As Object, ByVal e As System.EventArgs) Handles VALtxtJob.Validated
VALtxtJob.Text = VALtxtJob.Text.Trim
If VALtxtJob.Text = "" Then
ErrProv.SetError(VALtxtJob, "Cannot be empty!")
Else
ErrProv.SetError(VALtxtJob, Nothing)
End If
End Sub
 
Forgot to say that i use one error provider for about 6 textboxes. For each one i may need not to be empty or to have a valid entry or or ... In these cases i setError to the textbox control with a different message as the tab changes (textbox looses focus). When data are valid i clear the error with Nothing.


Hope that helped
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top