Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Posted
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.
Anybody looking for a graduate programmer (Midlands, England)?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...