none
vb 2012 hiding a sub-menu form disables main menu RRS feed

  • Question

  • I am running Visual Studio Express for windows desktop under Window 10. I have a main form on my VB application with a menu item called "Utilities".  The "Utilities" menu item has several sub-menu items.  One of these sub-menu items is called "Diagnostics".  The "Diagnostics" sub-menu item has several sub-menu items.  One of these sub-menu items is called "Check Pictures".  The "Check Pictures" sub-menu item invokes the code: CheckPictures.ShowDialog().  The loaded form is the "Check Pictures" form.  It has code invoking a process that shows a progress bar and takes several hours to complete.  I want to hide the "Check Pictures" form so I can invoke other items from the main form, so I added a button on the "Check pictures" form called "Hide".  This button invokes the code: me.hide.  The "Check Pictures" form disappears, but the menu items on the main form stop working.  How can I correct this?

    RONATMOODYLAKE


    Thursday, November 23, 2017 5:07 PM

Answers

  • Hi

    Why use ShowDialog? That would prevent the return to the main Form.

    Use Show instead and maybe that will help.

    Also, you could consider using a BackGroundWorker on the main Form -the Progress bar could be shown on the Main Form instead. Indeed, depending on your other uses on Form2, maybe it isn't needed at all if all you do is hide it anyway.


    Regards Les, Livingston, Scotland

    • Marked as answer by RONATMOODYLAKE Thursday, November 23, 2017 7:25 PM
    Thursday, November 23, 2017 6:40 PM

All replies

  •  Well,  i don't seem to be able to reproduce the problem when testing this scenario with my code.  Without us knowing how any of your code is set up to work or the actual code you use,  we could only take one wild guess after another as to why you can't use the menu on the main form after hiding a secondary form.


    If you say it can`t be done then i`ll try it

    Thursday, November 23, 2017 6:26 PM
  • Part of my application hides a secondary form successfully.  The form in question is a tertiary form ie. main menu item->secondary menu item->third menu item->application

    RONATMOODYLAKE

    Thursday, November 23, 2017 6:36 PM
  • Hi

    Why use ShowDialog? That would prevent the return to the main Form.

    Use Show instead and maybe that will help.

    Also, you could consider using a BackGroundWorker on the main Form -the Progress bar could be shown on the Main Form instead. Indeed, depending on your other uses on Form2, maybe it isn't needed at all if all you do is hide it anyway.


    Regards Les, Livingston, Scotland

    • Marked as answer by RONATMOODYLAKE Thursday, November 23, 2017 7:25 PM
    Thursday, November 23, 2017 6:40 PM