Accessing a UserControl's methods from a page

  • Thread starter Thread starter Shawn
  • Start date Start date
S

Shawn

Hi.
I've created a UserControl and included it in all my pages. The UserControl
contains a panel and a property, which sets the panel's visibility. I need
to be able to access this property from all my pages. I could declare both
the property and the panel as "Shared", that will work, but I'm not sure
that is the best way to go.. Or maybe it is? Any thoughts??

Thanks,
Shawn
 
Hi,

I think that it's better to follow OO practice and create method (with
code to access panel) that will hide the class internal data from the
caller.

Natty Gur[MVP]
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377
 
Yes, but how? Thats what I can't figure out..

Shawn

Hi,

I think that it's better to follow OO practice and create method (with
code to access panel) that will hide the class internal data from the
caller.

Natty Gur[MVP]
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377
 
Hi,

If i get you right ...

Add public function to the user control class. inside the public
function write the code to change innner control data.

Natty Gur[MVP]
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377
 
Yes, I can do that, but then I have to drop the "MustInherit" from the
UserControl class declaration. Is that a problem? I'm guessing it's
supposed to be there since VS declared it that way... Or am I wrong?

Shawn



Hi,

If i get you right ...

Add public function to the user control class. inside the public
function write the code to change innner control data.

Natty Gur[MVP]
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377
 
Back
Top