471,601 Members | 1,218 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.

Getting reference to an ErrorProvider

J L
I have a from with an ErrorProvider on it. I pass a reference of the
form to a subroutine where I want to reference the ErorrProvider. I
could pass it in the call to the subroutine, but I would like to
dreive it from the reference to the form that I am already passing.

Can this be done?

TIA
John

Nov 21 '05 #1
3 1332
Hi John,

Sure it can. In your form create a new public property which returns the
instance of your ErrorProvider:

---
Public ReadOnly Property GetErrProvider
Get
Return _errorProvider ' or whatever you named the control
End Get
End Property
---

Regards,
-Adam.

J L wrote:
I have a from with an ErrorProvider on it. I pass a reference of the
form to a subroutine where I want to reference the ErorrProvider. I
could pass it in the call to the subroutine, but I would like to
dreive it from the reference to the form that I am already passing.

Can this be done?

TIA
John

Nov 21 '05 #2
J L
Hi Adam,
Thanks for the tip. Since I have several forms that I need to
"discover" their errorprovider, I was hoping to find a way to do it
like using a For Each loop. But error providers do not show up in the
control collection and I tried components and that did not seem to
work. So if worse comes to worse, I will have to creat a property as
you suggest. Thanks for your input!

John

On Sat, 09 Apr 2005 16:47:46 +0930, Adam Goossens
<ad**********@users.sourceforge.net> wrote:
Hi John,

Sure it can. In your form create a new public property which returns the
instance of your ErrorProvider:

---
Public ReadOnly Property GetErrProvider
Get
Return _errorProvider ' or whatever you named the control
End Get
End Property
---

Regards,
-Adam.

J L wrote:
I have a from with an ErrorProvider on it. I pass a reference of the
form to a subroutine where I want to reference the ErorrProvider. I
could pass it in the call to the subroutine, but I would like to
dreive it from the reference to the form that I am already passing.

Can this be done?

TIA
John


Nov 21 '05 #3
John,

Yeah, error providers appear to be strange little things and sit "over"
your form rather than as a part of it (eg, inside the Controls or
Components collections).

I can't think of any other (simple) solution other than implementing a
property. You might consider deriving all of your forms from a common
base class and placing your error provider and accessor property in there.

Good luck,
-Adam.

J L wrote:
Hi Adam,
Thanks for the tip. Since I have several forms that I need to
"discover" their errorprovider, I was hoping to find a way to do it
like using a For Each loop. But error providers do not show up in the
control collection and I tried components and that did not seem to
work. So if worse comes to worse, I will have to creat a property as
you suggest. Thanks for your input!

John

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Martijn Leine | 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
5 posts views Thread by Alvaro Lamas | last post: by
4 posts views Thread by Freeon | 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.