locked
HIDE and SHOW? Are they opposites? RRS feed

  • Question

  • Hey guys,

         I'm running into an issue with something that I'm trying to do. I have a main form. On this main form, there is a point in time where the user clicks a button to bring up another form. However, I would like to be able to HIDE the main form in the background. I'm able to do this by frmMain.ActiveForm.Hide(); and it works perfectly. 

    However, when the secondary form is closed, I'd like to Un-Hide that main form. 

    Normally, I would just have the next form maximized and cover the previous form and then not show it in the taskbar, but in this case I want to hide and show the form, while it's loaded.

    Any idea how I can do this?

    When the secondary form closes and the modal is returned to the main form, I put frmMain.ActiveForm.Show(); and it doesn't do anything.


    Thanks!!!

    Todd 
    Todd J.
    Friday, June 20, 2008 3:18 PM

Answers

All replies

  •  For questions and discussions regarding client application development using Windows Forms controls and features, please see http://forums.microsoft.com/msdn/ShowForum.aspx?ForumID=8&SiteID=1

    http://www.peterRitchie.com/blog
    • Marked as answer by Peter Ritchie Friday, June 20, 2008 3:31 PM
    Friday, June 20, 2008 3:28 PM
  • After the new form closes there is no ActiveForm, try just frmMain.Show().  When the main form creates the new form, subscribe to the FormClosed event.  When you receive that event you know to restore your main form (frmMain.Show())
    http://www.peterRitchie.com/blog
    • Marked as answer by Todd Blah Friday, June 20, 2008 3:31 PM
    • Unmarked as answer by Todd Blah Friday, June 20, 2008 3:33 PM
    Friday, June 20, 2008 3:31 PM
  • Thanks Mark, I appreciate it!
    Todd J.
    Friday, June 20, 2008 3:32 PM
  • Hi Mark, I just tried it and there is no method for frmMain.Show();?

    Thanks,

    Todd
    Todd J.
    Friday, June 20, 2008 3:34 PM
  • If you have frmMain.ActiveForm.Show() then frmMain.Show should be available.

    It's likely better to use frmMain.Visible = true; instead.


    http://www.peterRitchie.com/blog
    Friday, June 20, 2008 3:49 PM
  • That's what I would figure too... but apparently not?

    I have switched to using Visible, but there isn't an option for me to set it back unless I select ActiveForm.

    I'm using VS 2005.


    Thanks,
    Todd J.
    Friday, June 20, 2008 5:03 PM