Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: For Scott: Accessing a variable set in a usercontrol from another usercontrol


Message #1 by "Patrick Barnes" <patrick@g...> on Thu, 22 Mar 2001 14:06:17 -0600
Hi Scott,



I want to be able to access a variable set in a usercontrol from within

another usercontrol. I'm pretty new to OOP and VB.NET in particular, so I

can't figure this out.



I have a Public variable in a usercontrol that gets loaded by a WebForm.

Another usercontrol registered on that same form then gets loaded, and I

want to set the text property of a label in the second usercontrol based on

the variable set in the first user control.



If my first usercontrol is registered with an ID of "Header", and the

variable I set within it is strLabelText, I thought I could just access it

with this syntax: Me.Page.FindControl("Header1").strLabelText, or something

like that. I know I have to go up the tree to the Page object and then back

down, but nothing seems to work.



Thank you!! May I add that I am overwhelmed by the support Microsoft has

given to launching .NET and helping developers come up to speed. Truly

amazing.



Patrick Barnes

Web Application Developer

Geonetric Technologies

200 1st Avenue NE  Suite 220

Cedar Rapids, Iowa  52401

P:319.221.1667 / F:319.221.1450 / www.geonetric.com




  Return to Index