Only show main form in task list??? How??

  • Thread starter Thread starter BGD
  • Start date Start date
B

BGD

How do I prevent forms other than the main form in a project from appearing
in the task list? I saw an article that mentioned subclassing when showing
the second form and then un-subclassing when closing it.

Thanks
 
This is asked a lot, and a google search would have provided the answer, so
I recommend using it in the future.

The "Running Programs" list shows the captions of all top-level forms, it
does not enumerate processes. To "hide" a form from the list, make its
caption empty.

-Chris
 
This does prevent the second form from showing up in the task list, but
if was opened using the ShowDialog() method then it is possible to make the
main form inaccessible.

If the second form is visible (via ShowDialog()) and then you switch to
the task list you will only see the title of the main form in the task list
as the title of the second form is blank, but now try accessing the main
form by selecting it in the task list and choose activate. The main form is
shown but you can't select any controls on it as it is waiting for the
second form to be closed. The second form is inaccessible as you can't
choose it in the task list and thus the only choice is to open the task list
and terminate the main form.

This is why I'd prefer to use subclassing, but I don't know how...
 
So what you need to do is set your main form's text property (ie Me.Text) to
"" when you open the dialog and set the dialog's text to whatever your
application is called. When your dialog closes and control returns to your
main form you reset the text property on your main form to your application
name.

If you do this then selecting your application in the task list and pressing
activate will take you back to your dialog if it is open or to your main
form if it is not.

Hope this helps,
John
 
Back
Top