By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,515 Members | 1,033 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,515 IT Pros & Developers. It's quick & easy.

Error provider

P: n/a
I have an errorprovider in a tabControl

i use this to validating all field required
Private Sub Champs_Validating(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles txtSociete.Validating,
txtAdresse.Validating, txtCodePostal.Validating, txtVille.Validating
Dim monControl As TextBox = CType(sender, TextBox)
If (monControl.Text.Trim().Length = 0) Then
ErrorProvider1.SetError(monControl, "Merci de renseigner ce
champ.")
Else
ErrorProvider1.SetError(monControl, "")
End If

End Sub
===>> my problem : When i click the submit button... (and my requiered
fields are empty) nothing stop me...!!!

Why ?

Mar 23 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
may be hard to stop you :) Let's see if we can at least stop the exit
from the edit state with:

e.Cancel = True
.....
Else
ErrorProvider1.SetError(monControl, "")
End If

Mar 23 '06 #2

P: n/a
oh thx but it's only work for my first control Handles
txtSociete.Validating

all the other txtAdresse.Validating, txtCodePostal.Validating,
txtVille.Validating doesn't work

i must have several validating sub ??? for working ?

Mar 23 '06 #3

P: n/a
no sorry it's only working if the empty field have the focus

Mar 23 '06 #4

P: n/a
it depends on the effect you want to achieve. If you want to let the
user free to do anything and check only at the end, you will do the
checking at the "Closing" event (assuming we are talking of a kind of
dialog form) ...

Mar 23 '06 #5

P: n/a
i have a form and some field in a form

when the user click submit i want to stop it if the requiered field are
empty

i think errorprovider with validating could do that ? but it's working
only if the user leave all requiered field with empty to have a warning
!!!

Mar 23 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.