Sheritlw
asked on
Create a Taskbar of Open MDI Child Forms
I want to create a task bar similar to windows (with the start button) that displays all open mdi child forms.
I would like them to be able to click on a child form and bring it to the front.
Please provide sample code and not a link. My IE crashes when I click on links.
Thanks
I would like them to be able to click on a child form and bring it to the front.
Please provide sample code and not a link. My IE crashes when I click on links.
Thanks
ASKER
Hi Jpaulino,
How do I make the status strip just show the form names along the bottom, instead of as a menu item... similar to the Windows Taskbar?
Thanks
How do I make the status strip just show the form names along the bottom, instead of as a menu item... similar to the Windows Taskbar?
Thanks
Have you tried ?
ASKER
Yes, I have, but can't figure out what to declare it as.
Dim ft As New frmMembers
TaskbarMenu = New ContextMenuStrip
ft.MdiParent = Me
ft.WindowState = Me.WindowState
ft.Show()
' Dim f As New Form2
' f.MdiParent = Me
ft.Name = "frmMembers" & x
ft.Text = "Teams/Members" & x
ft.Show()
TaskbarMenu.Items.Add(ft.T ext)
x += 1
Dim ft As New frmMembers
TaskbarMenu = New ContextMenuStrip
ft.MdiParent = Me
ft.WindowState = Me.WindowState
ft.Show()
' Dim f As New Form2
' f.MdiParent = Me
ft.Name = "frmMembers" & x
ft.Text = "Teams/Members" & x
ft.Show()
TaskbarMenu.Items.Add(ft.T
x += 1
You don't need that .. I have only used to have diferent names for the forms. You just need to use ToolStripStatusLabel1 click event.
ASKER
I do have all your code in there and when I click on the status bar it does say what the form text is... but
I wanted the status strip to display the forms that are open something like...
Members 0 Timers 0 Members 1 Races 0
Above is an example of the statusstrip which displays all the child forms that are open. They toolstripstatuslabel should display the name of the form and then when they click on the name, it brings that instance of the form to the front.
Right now I have to click on the status strip to get a name to display.
Thanks,
I wanted the status strip to display the forms that are open something like...
Members 0 Timers 0 Members 1 Races 0
Above is an example of the statusstrip which displays all the child forms that are open. They toolstripstatuslabel should display the name of the form and then when they click on the name, it brings that instance of the form to the front.
Right now I have to click on the status strip to get a name to display.
Thanks,
Ok, I have understood it wrong !
You want the names in the status bar ? But for that you have to call a function each time you open or close a new child form.
You want the names in the status bar ? But for that you have to call a function each time you open or close a new child form.
ASKER
Yes, that is why I added the add.item to the click event of the form being opened.
I figured it shouldn't be declared as contextmenu etc., but not sure. I tried with the intellisence to see if there was anything else that made since, but with no luck.
I don't mind calling a function when I load a form, just don't know what the code would be.
Thanks
I figured it shouldn't be declared as contextmenu etc., but not sure. I tried with the intellisence to see if there was anything else that made since, but with no luck.
I don't mind calling a function when I load a form, just don't know what the code would be.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
So far this is great.
Only problem I'm having is I put the call to the showform sub procedure in...
Private Sub StatusStrip1_ItemClicked(B yVal sender As Object, ByVal e As System.Windows.Forms.ToolS tripItemCl ickedEvent Args) Handles StatusStrip1.ItemClicked
showForm(sender, e)
'Dim frm As Form = My.Application.OpenForms(e .ClickedIt em.Text)
'If frm IsNot Nothing Then
' frm.BringToFront()
'End If
End Sub
Unfortunetly the sender is not of the same type. Where should I put the call to the showform procedure?
Thanks
Only problem I'm having is I put the call to the showform sub procedure in...
Private Sub StatusStrip1_ItemClicked(B
showForm(sender, e)
'Dim frm As Form = My.Application.OpenForms(e
'If frm IsNot Nothing Then
' frm.BringToFront()
'End If
End Sub
Unfortunetly the sender is not of the same type. Where should I put the call to the showform procedure?
Thanks
You don't need this code you have showed!
When you create the new ToolStripStatusLabel in the form load it adds handler to the showForm. The showForm does that already
When you create the new ToolStripStatusLabel in the form load it adds handler to the showForm. The showForm does that already
ASKER
Hi jpaulino,
I tried to click on it without using the statusbar itemclick event, but nothing happens.
I added ...
Dim ts As New ToolStripStatusLabel
ts.Text = Me.Text
AddHandler ts.Click, AddressOf showForm
My.Forms.frmMain.StatusStr ip1.Items. Add(ts)
to every child forms load event.
I also added your sub procedure to a module.
Public Sub showForm(ByVal sender As Object, ByVal e As System.EventArgs)
Dim t As ToolStripStatusLabel = DirectCast(sender, ToolStripStatusLabel)
' Gets the selected form and show it
Dim frm As Form = My.Application.OpenForms(t .Text)
If frm IsNot Nothing Then
frm.BringToFront()
End If
End Sub
What am I doing wrong?
Thanks
I tried to click on it without using the statusbar itemclick event, but nothing happens.
I added ...
Dim ts As New ToolStripStatusLabel
ts.Text = Me.Text
AddHandler ts.Click, AddressOf showForm
My.Forms.frmMain.StatusStr
to every child forms load event.
I also added your sub procedure to a module.
Public Sub showForm(ByVal sender As Object, ByVal e As System.EventArgs)
Dim t As ToolStripStatusLabel = DirectCast(sender, ToolStripStatusLabel)
' Gets the selected form and show it
Dim frm As Form = My.Application.OpenForms(t
If frm IsNot Nothing Then
frm.BringToFront()
End If
End Sub
What am I doing wrong?
Thanks
ASKER
Hi JPaulino,
I have it working.
I only added name to both the load procedure and the module.
ts.Name = Me.Name (in load)
Dim frm As Form = My.Application.OpenForms(t .Name) (In module)
You are GREAT! I really appreciate all your help.
Thank you,
Sheri
I have it working.
I only added name to both the load procedure and the module.
ts.Name = Me.Name (in load)
Dim frm As Form = My.Application.OpenForms(t
You are GREAT! I really appreciate all your help.
Thank you,
Sheri
ASKER
Excellent!!!!
Sorry I was out for some hours!
Glad I could help!
jpaulino
Glad I could help!
jpaulino
Add a StatusStrip to your mdi form, create a new ToolStripStatusLabel on the StatusStrip and use this code adapting for your needs:
Open in new window