473,395 Members | 2,446 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

MDI Menu Icon - not showing - then showing

VB 2005 Express.

I can create a simple MDI app, with 2 forms.
On Form1
I add a menustrip on top - and click on ( Insert Standard Items )
Add a ToolStrip as well and add 2 buttons.

On Form2, add a form Icon
On Form3, add a form Icon

Now, On form1 here is the code I have.
======
Public Class Form1

Public Shared fForm2 As Form2 = Nothing
Public Shared fForm3 As Form3 = Nothing
Private Sub ToolStripButton1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles ToolStripButton1.Click
fForm2 = New Form2
fForm2.MdiParent = Me
fForm2.WindowState = FormWindowState.Maximized
fForm2.Show()

End Sub

Private Sub ToolStripButton2_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles ToolStripButton2.Click
fForm3 = New Form3
fForm3.MdiParent = Me
fForm3.WindowState = FormWindowState.Maximized
fForm3.Show()
End Sub
End Class
======

When I run this app, and click on button1, form2 opens, but without the
Form Icon in the menustrip. Instead it shows the default VS icon.
Now Click on Fom2 Button, and it shows the new form again with the
default vs icon. Now click the "x" / close the form3 and now form2 is
still showing - and now with an icon.

I have checked the msdn formus and have found somewhat of a solution,
and as I understand it, it is below.

What I had to do was this:
Public Class Form2

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.WindowState = FormWindowState.Normal
End Sub

Private Sub Form2_Shown(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Shown
Me.WindowState = FormWindowState.Maximized
End Sub
End Class
So now I am wondering - ( i am a newbie ) but i think i have the
terminology,... is there a way I can make a Sub that handles all my
child forms? So i dont have to keep adding this "fix" code to all my
forms.

Im assuming I have to put something in the Handles <all forms.load but
im not sure what that is.

Thanks

Miro
Oct 4 '07 #1
1 2266
Thank,
exactly what I wanted to do,
I have done it that way:

In the MDI from i am declaring instance of the child form(s) :

frm_Child1 = new FormChild
AddHandler frm_Child1.Shown, AddressOf ShowChildIcon
frm_Child1.Name = formText
frm_Child1.MdiParent = Me
frm_Child1.show
and sub:

Private Sub ShowChildIcon(ByVal sender As Object, ByVal e As
System.EventArgs)
sender.windowstate = FormWindowState.Maximized
End Sub

you can use this sub for all you child forms.
Only add handler for them when you create their instances

Oct 9 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Lalit | last post by:
Hi Friends, I have developed a Windows service. Now i need icon for this service in systray and context menu fo this icon. Can i do this? With regards, Lalit
8
by: Adrian | last post by:
How do I put an icon on a form using code? Thank you.
0
by: Alireza Haghshenass | last post by:
Dear All, I am facing a problem which I could not solve. I am writing an application which uses a notify icon and a context menu bound to it to show modal dialog forms. When these forms is shown...
2
by: Bonj | last post by:
Looking for a good example of how to show a popup menu in response to the user right-clicking on the icon in the 'taskbar notification area' (tray). I'm fine with creating the icon and responding to...
2
by: Gary Brown | last post by:
Hi, How do you remove an icon from the task switcher menu? (The one you get with ALT-TAB.) I think I asked this before but never got an answer. Now I have another app that shows an icon for...
2
by: David Veeneman | last post by:
I'm just getting started with WPF and XAML, and I am trying to create a traditional menu bar. Everything works until I get to the menu icons. I can add a bitmap icon to a menu item using this XAML...
0
by: dipalihulsure | last post by:
Hello friends, I am trying to get a popup menu on the right button click event. Code is as follows ...
8
by: starrysky | last post by:
I have a program which puts an icon in the notification area and has a menu associated with it available by right clicking on the icon. I want the menu items to be selected by single left clicks but...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.