473,473 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Adapting menu if child is opened

I have a main form (an mdi container) with a menu and the item "open".
When clicking "open" a child form appears. Now, i don't want that
several childforms are opened. So i want the "open" item to be
disabled when this child form is shown. When i close this child form
i want the "open" item in the menu to be enabled again so that i can
open the child form whenever i want. How can i do this? Anyone an
idea?

thx.
Nov 20 '05 #1
4 846
"Kenny" <ge*******@hotmail.com> schrieb
I have a main form (an mdi container) with a menu and the item
"open".
When clicking "open" a child form appears. Now, i don't want
that
several childforms are opened. So i want the "open" item to be
disabled when this child form is shown. When i close this child
form i want the "open" item in the menu to be enabled again so that i
can open the child form whenever i want. How can i do this? Anyone
an idea?


In the menuitem's click event, set it's enabled property to false (that's
what you probably aready know). After creating the instance of the child
within the MDI container, use the Addhandler statement to handle the closed
event of the child. In the event handler, enable the menuitem.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2
"Armin Zingler" <az*******@freenet.de> wrote in message news:<uJ**************@TK2MSFTNGP11.phx.gbl>...
"Kenny" <ge*******@hotmail.com> schrieb
I have a main form (an mdi container) with a menu and the item
"open".
When clicking "open" a child form appears. Now, i don't want
that
several childforms are opened. So i want the "open" item to be
disabled when this child form is shown. When i close this child
form i want the "open" item in the menu to be enabled again so that i
can open the child form whenever i want. How can i do this? Anyone
an idea?


In the menuitem's click event, set it's enabled property to false (that's
what you probably aready know). After creating the instance of the child
within the MDI container, use the Addhandler statement to handle the closed
event of the child. In the event handler, enable the menuitem.


Can you give me some more information cause i don't quite understand.
This handling stuff isn't really my bag.
Nov 20 '05 #3
"Kenny" <ge*******@hotmail.com> schrieb
Can you give me some more information cause i don't quite understand.
This handling stuff isn't really my bag.

In the menuitem's click event, set it's enabled property to false (that's
what you probably aready know).
directcast(sender, menuitem).enabled = false
After creating the instance of the child
private m_Child as form2 'at class level (= field of the class)
'...
m_child = new form2
within the MDI container, use the Addhandler statement to handle the closed event of the child.
addhandler m_child.closed, addressof ChildClosed
In the event handler, enable the menuitem.


....and remove the handler:

private sub ChildClosed( _
ByVal sender As Object, ByVal e As System.EventArgs)

menuitemx.enabled = true
removehandler m_child.closed, addressof ChildClosed
m_child = nothing
end sub
--
Armin

Nov 20 '05 #4
"Armin Zingler" <az*******@freenet.de> wrote in message news:<40***********************@news.freenet.de>.. .
"Kenny" <ge*******@hotmail.com> schrieb
Can you give me some more information cause i don't quite understand.
This handling stuff isn't really my bag.

In the menuitem's click event, set it's enabled property to false (that's
what you probably aready know).


directcast(sender, menuitem).enabled = false
After creating the instance of the child


private m_Child as form2 'at class level (= field of the class)
'...
m_child = new form2
within the MDI container, use the Addhandler statement to handle the

closed
event of the child.


addhandler m_child.closed, addressof ChildClosed
In the event handler, enable the menuitem.


...and remove the handler:

private sub ChildClosed( _
ByVal sender As Object, ByVal e As System.EventArgs)

menuitemx.enabled = true
removehandler m_child.closed, addressof ChildClosed
m_child = nothing
end sub


You are my hero!
Nov 20 '05 #5

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

Similar topics

13
by: elad | last post by:
Hi The Menu doesn't work properly when I have 2 frame and the Menu popup frame=document target frame, when I choose item in the menu the doc opened and the menu get stuck. Here is the code...
4
by: Yuk Cheng | last post by:
<<<start index.htm>>> <html> <head> <script> function perform(action){ } </script> </head>
2
by: DNK | last post by:
I have an MDIParent and a menu item "Show Status". By clicking on it, 'Show Status' Child Window has to be opened & Menu has to be disabled. by closing the Child menu has to be enabled. How...
2
by: Mahesh.V | last post by:
Hi All Am using VB.NET menu object. I have a MDI screen and menu is attached to the MDI screen. When I try to open a child window with in the MDI, the Child window's menu gets appended to the MDI...
1
by: poppy | last post by:
I have an application which has a MDI parent form and a simple menu bar. Using reflection I can get access to other assemblies and add an item to my parent menu which when clicked opens up the main...
4
NoPeasHear
by: NoPeasHear | last post by:
My problem - the first cell of my table is adapting the .nav class rather than .menu class that I am assigning it. How can I fix it? My code starts out as the following... <link...
1
by: coolarian | last post by:
Hi, Please anyone who could help me implement this requirement: From the parent's menu strip item I need to cause a button_click event in one of the child. In my MDI Parent I have this code:...
2
by: fjohnson | last post by:
Hello, I have a CSS Horizontal dropdown menu and the drop down menu is pushed to the right instead of directly underneath the heading. I am completely new to CSS and I do not yet know exactly what...
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.