Click here to Skip to main content
15,896,500 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can I access my controls via shared functions?
Posted
Updated 19-Jul-10 18:23pm
v2
Comments
Sandeep Mewara 19-Jul-10 14:18pm    
Would you elaborate more on what you are trying to do?

You can't, because a static method does not have a reference to the objects. You need to pass them in, or do some really nasty stuff with the Application.Current.OpenWindows object to find the right form and cast it to the right type. Either way, your controls should never be visible outside the form, only properties you want to access should be exposed.
 
Share this answer
 
Just to add, if you're using ASP.NET, your controls don't even exist outside of your page lifecycle, so why do your methods have to be shared ?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900