Swithing between child windows, Like Internet Explorer - Forward Back

oceaniana

Member
Joined
Apr 1, 2006
Messages
11
Programming Experience
Beginner
Hi
I need help on swithing between child windows, I have one parent form and say 3 child forms, that get opened up by MenuStrip on parent form1, but some times u end up with a few child windows open so it would be good to be able to hit forward or back button to scroll though them

i have the below setup
Form1
Child1
Child2
Child3

Private Sub ToolStripMenuItem6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem6.Click
'Back Button

End Sub
Private Sub ToolStripMenuItem7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem7.Click
'Foward Button

End Sub

Best way to put it is to be able to scroll though like internet explorer Forward Button & Back for ToolStripMenu
Any feed back would really be appreaciated.
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,602
Location
Sydney, Australia
Programming Experience
10+
You're getting two things mixed up. What IE provides is a history list. There is only a single window but it keeps a record of the documents that have been opened. What you're talking about with the MDI children is a different thing altogether. They are all open forms so there's no history involved. Why would you want to go back and forward when all the windows are all currently open.

If you want a list of open MDI children then just assign a menu item to the MdiWindowList property of your MenuStrip and a list of child windows will be added to it automatically. The convention is to add a Window menu item and use that.

If you want a history list then it's up to you to store all the windows that have been opened and provide a means to navigate them, but I don't think that that is realyy what you want.
 

oceaniana

Member
Joined
Apr 1, 2006
Messages
11
Programming Experience
Beginner
Thank You for your reply :D

If you want a list of open MDI children then just assign a menu item to the MdiWindowList property of your MenuStrip and a list of child windows will be added to it automatically. The convention is to add a Window menu item and use that.

Yes this sounds good, could you leave a sample code. Im a bit lost how to go about this

Thank You :)
 

oceaniana

Member
Joined
Apr 1, 2006
Messages
11
Programming Experience
Beginner
Really lost, i hope u r talking about MdiWindowListItem??

Binding
Child1BindingSource - IsMdiContainer

Data Source Update Mode
OnValidation

Format Type
NoFormat

OK the actual name of it is now called Child1BindingSource

I dont think that is right, but i have never done this before if u could guide me to the next bit would really be appreaciated.

VB.NET:
[SIZE=2]
[/SIZE][SIZE=2][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] MenuItem7_Click([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Object, [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2] ToolStripMenuItem7.Click
MenuItem7.IsMdiWindowListEntry.GetType()
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff][/COLOR][/SIZE] 
[SIZE=2][COLOR=#0000ff] 
[/COLOR][/SIZE]
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,602
Location
Sydney, Australia
Programming Experience
10+
Yes it was MdiWindowListitem, but I'm not talking about doing anything in code. It's just a few clicks in the design window. Add an appropriate top-level menu item to your MenuStrip. Select the MenuStrip in the designer then go to the Properties window. Click on the MdiWindowListItem property and you will get a list of available items. Select the one you want the list to appear under and you're done. Everything else is taken care of for you. As you open and close child windows they will be automatically added to and removed from the menu. See the attached screenshots if you're unsure. One is the design time process and the other is the run time result.
 

Attachments

  • MdiWindowListItem.JPG
    MdiWindowListItem.JPG
    34.4 KB · Views: 61
  • MDI Window List.JPG
    MDI Window List.JPG
    21 KB · Views: 58
Top Bottom