Taskbar question...

ALX

Well-known member
Joined
Nov 16, 2005
Messages
253
Location
Columbia, SC
Programming Experience
10+
I missed a basic concept here, somehow... My app opens with a form that is the main menu. Let's say form A; which has it's "Shown in Taskbar" property set to TRUE. The user selects an option on form A and opens form B, which also has it's "Shown in Taskbar" property set to TRUE. As form B loads, form A is hidden so that if the user moves or resizes form B then form A will not be visible underneath. This replaces the taskbar button for form A with the one for form B. If the user then closes form B via the taskbar (right-clicking the taskbar button), form A then becomes the active form. I want the app to end if the user closes any windows from the taskbar. I've tried setting up form A to be the only form that's visible in the taskbar, but that makes me lose all taskbar buttons when form A is hidden. The idea is to have the taskbar button represent the app rather than just the currently active form and I don't want multiple forms on the display if the user decides to move things around. Is there a way to tell if a form has been closed via the taskbar? I suppose that I could move Form A around the display to match form B's position (to keep only one form visible at a time) if form B gets moved, but I'm guessing there's a more efficient way to do this.
 
It's impossible to tell specifically if a form was closed from the Taskbar because doing so is just closing it from its system menu. This is exactly the same as clicking the Close button on the title bar, pressing Alt+F4 or accessing the same system menu by clicking the top, left corner of the form.
 
Form B is shown as modal. If the user grabs Form B by the Title Bar and moves it to another position on the display, Form A is visible underneath. It gives the impression that Form A is a seperate entity. I'd like to keep a simple, linear interface.
 
I have another way that I can accomplish this task... If I show only the main menu in the taskbar, I can move and resize the main menu to match the currently shown form. This keeps Form A from showing up underneath Form B if the user moves or resizes Form B. The problem now is when Form B is minimized, I need to minimize Form A... and I don't think "Me.Minimize" is an option. How can I minimize Form A via code and hide Form B without it showing up at the bottom of the display's working area ?
One other issue here: Moving & resizing Form A to match Form B works in the IDE but not in the compiled version. Variable "Frm" = Form B...
VB.NET:
    Private Sub Frm_Move(ByVal sender As Object, ByVal e As System.EventArgs) Handles Frm.Move
        Me.Location = Frm.Location
    End Sub

My objective here is to make my user interface the same as any store bought software package where the app can be closed from the taskbar and there are not multiple forms floating around on the display. 'Seems like it should be basic.... No ?
 
Last edited:
Back
Top