471,601 Members | 1,209 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,601 software developers and data experts.

ErrorProvider problem

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
5 1550
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
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
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
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
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.

Similar topics

3 posts views Thread by Martijn Leine | last post: by
1 post views Thread by OShell77 | last post: by
6 posts views Thread by M O J O | last post: by
reply views Thread by Issac | last post: by
3 posts views Thread by Jeppe Jespersen | last post: by
4 posts views Thread by ljlevend | last post: by
4 posts views Thread by Freeon | last post: by
4 posts views Thread by csharpula csharp | last post: by
1 post views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by MichaelMortimer | last post: by
reply views Thread by CCCYYYY | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.