|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Getting reference to an ErrorProviderI 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 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: Show quoteHide quote > 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 > 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 <adamgooss***@users.sourceforge.net> wrote: Show quoteHide quote >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 >> 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: Show quoteHide quote > 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 >
arraylist copy
How to detect when items are added to Combobox/Listbox Why do we need Namespace and Module? Easiest way to generate XML in VB.NET Excaping recursive functions Possible values of DTE.ActiveDocument.Kind ? How do you force a thread to run on a specific processor? Inheriting forms problem bin folder Async Delegates polling for vb.net examples |
|||||||||||||||||||||||