RyanJones Posted April 24, 2006 Posted April 24, 2006 Hi all. I am new to C# (2 days learning) and I seen to have a problem. I have a form named frmMain that is the form initally loaded (starting form). How can I hide and show this from from another class? Do I need to use an object variable or is there another way to do this? (Have tried frmMain.Show() and frmMain.Hide() but they do not work). Thanks for the help, Ryan Jones Quote
Cags Posted April 24, 2006 Posted April 24, 2006 You can only access objects that are currently in scope. If you are using your frmMain to create for example a frmOptions, unless you pass frmOptions a reference (or store a static reference). There have been quite a few questions like this on the forum so a search should turn up a result. As a starting point if you setup the additional form to accept frmMain as a parameter, you can then store a local reference allowing you to Show() and Hide() the form whenever you want. Quote Anybody looking for a graduate programmer (Midlands, England)?
Leaders snarfblam Posted April 24, 2006 Leaders Posted April 24, 2006 Try this tutorial. The code is in VB, but the concepts are applicable. Quote [sIGPIC]e[/sIGPIC]
RyanJones Posted April 24, 2006 Author Posted April 24, 2006 Thanks for the hell all! I shall read the example tomorow :-) Cheers, Ryan Jones Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.