Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I apologize if someone asked this before.

 

I am using a MDI parent form and I want to replicate the same behavior as Windows does with groups. For instance, if I go to Microsoft Word, and open four documents, Windows groups the four documents together, but Word remains the parent form. Has anyone been able to duplicate this behavior??

 

In my case, I am opening multiple forms but I am running into the problem of having to minimize some of the forms to return to a previous form I opened. For instance, I open form 1, then open form 2 which opens form 3. Well, if I want to return to form 1 I have to minimize form 2 and 3 to return to it. If there is a better idea to handle this situation I'd be appreciative.

Posted

You need to spin through your mdiChildren collection from the mdiParent control and find the open instance form1, or whatever form you wish to bring-to-front.

 

I know aout the BringToFront method' date=' but I can't use that method unless I have a way to bring that form up.[/quote']
Posted

Let me clarify.

 

This is my issue. I have a main form that serves as my MDIParent. It only contains a main menu somewhat similar to Word or Access. Now, my issue is this, when a new form is created it is automatically maximized. So, in the main form I have this code:

 

Dim formB as new FormB
formB.MdiParent = Me
formB.Show()

 

FormB then appears. Now if I open another form say FormC, it will appear maximized thus hiding FormB behind it. Now the only way a user can get back to FormB is by minimizing FormC or closing FormC altogether. Now I know I can press Ctrl + F6 and spin through the child forms, but the users are used to Word and Access so they are looking in the windows explorer bar at the bottom of the screen for FormB but it's not there, just the instace of the Main form is in the bar. I thought about not using the MDIParent, but I want all of the child forms to close when the main form closes.

 

If you're still wondering what I'm talking about, open up Microsoft Access. And then open up multiple forms in one of your databases. Access is the main form and each form that you open appears in the explorer bar at the bottom as it's own instance. But when you close the main form of Access, all of the child forms close along with it. Also, if I minimize the main form in Access, all of the child forms are minimized with it, which is also important to me.

 

So, again my question is, does anyone know how to duplicate this behavior?? I want each instance of a new form that I create from the main form to appear in the explorer bar.

Posted (edited)

It sounds to me like what you'll need to do is create a new file-menu item like "Open Windows" and add new menu items and events point to your new child windows as you open said child windows.

 

You'll also have to add cleanup code to remove the menu items as you close the child forms so there's not a chance of null references with displaying a form that is no longer available.

 

To my knowledge, there isn't an automatic means to generate the file menu to reference your child form instances, just good old-fashioned manual code writing.

 

Check out this link, I think it may help you: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtskcreatingwindowlistformdiform.asp

Edited by mocella
Posted

It's an interesting feature, but not what I'm looking for. I specifically need the new form to appear on the explorer bar along with the main form at the bottom of the screen.

 

I figure if Access does it, there's got to be a way. I did look at the MDI form section on MSDN but I didn't see any information that could help me in my situation.

Posted

Okay, I was thinking the menu-bar, not the window's taskbar. Here's what I dug up in Google Groups - haven't tried it, but it seems logical:

 

Dim m_oTB As New TaskbarList

Private Sub Form_Activate()
  m_oTB.ActivateTab hWnd
End Sub

Private Sub Form_Load()
  m_oTB.HrInit
  m_oTB.AddTab Me.hWnd
End Sub

Private Sub Form_Unload(Cancel As Integer)
  m_oTB.DeleteTab hWnd
End Sub

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...