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

ErrorProvider problem

P: n/a
I have a problem with the ErrorProvider with a mdi interface, I have a MDI
form which opens a child form, that child form uses the errorprovider to
show the problems with the data entry. The problem happens when I use the
show method of the child form it will try to validate the first field and
since it need to not empty and its just opening for the first time it fails
and the errorprovider shows an error icon, something that I obviously dont
want since the user hasnt done anything wrong yet. any Ideas?

Thanks in advanced.
Alvaro
Nov 21 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Alvaro,

Did you use the "getfocus" event instead of the "validating" event in the
MDI form. It sounds like that.

However I think you need to show some "sample" code how you did it.

I hope this helps

Cor
Nov 21 '05 #2

P: n/a
Well I did use validating here is the code where I create the child form:

Dim FormInstance As MyForm

FormInstance = New MyForm(ks_FormType.ks_Adding)

FormInstance.MdiParent = Me

FormInstance.Show()

FormInstance = Nothing

Here is the code where I use the error provider to validate:

Private Sub Name_Validating(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles Name.Validating

If IsNothing(Me.Name.Text) Or (Me.Name.Text = "") Then

Me.epPuesto.SetError(Me.txtNombre, "ERROR MESSAGE")

e.Cancel = True

Else

Me.epPuesto.SetError(Me.txtNombre, "")

e.Cancel = False

End If

End Sub

I have basically the same code in all the rest of the controls in that form.
One thing I did notice is that in a dialog that I call upon with the same
validation scheme doesn't produce the same error and the only diference that
I can see is that said dialog isn't a child of the main program form.

Alvaro, again thanks in advanced.

"Cor Ligthert" <no************@planet.nl> escribió en el mensaje
news:OR**************@TK2MSFTNGP09.phx.gbl...
Alvaro,

Did you use the "getfocus" event instead of the "validating" event in the
MDI form. It sounds like that.

However I think you need to show some "sample" code how you did it.

I hope this helps

Cor

Nov 21 '05 #3

P: n/a
Alvaro,

It seems to me that MyForm is not a standard form, however an inherited
form. So answering withouth to know that, and as well what you are doing
with that, makes it in my opinion not simple.

Better to say what does that member in MyForm?

Cor
Nov 21 '05 #4

P: n/a
It is a standard form, it just has a modified constructor to know who is
calling it and for what reason. the wierd thing is that another form that I
open that I am not making a child of the mdi parent and that I call upon
using the showdialog method instead of the show method, in this case the
problem doesnt arrise.
"Cor Ligthert" <no************@planet.nl> escribió en el mensaje
news:Oo*************@TK2MSFTNGP09.phx.gbl...
Alvaro,

It seems to me that MyForm is not a standard form, however an inherited
form. So answering withouth to know that, and as well what you are doing
with that, makes it in my opinion not simple.

Better to say what does that member in MyForm?

Cor

Nov 21 '05 #5

P: n/a
Alvaro,

I have answered you on this in your other thread.

Cor
Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.