473,739 Members | 7,912 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to get parent control of the context menu stip

hi guys,
i'm working on the context menu for the controls.
the problem i'm facing right now is like this :
i want to use one context menu for more then one controls lets say i
want to use one context menu for 3 treeview controls as 3 of them
shares same type of menu.
what i'm not able to do is, i can not idetify which control has invoke
the context menu's event. let say one of the treeview control has
invoke an event "Reset" from the context menu. all i need to do is, to
find out which treeview has invoked the event and needs to refill the
treeview control.

i tried to find out how to get the parent control but i failed to do
so.

tools
c#.net 2.0 (VS.NET 2005)

can anyone give me any kind of suggestion on this.

thanks,
Lucky

Aug 30 '06 #1
2 11687
Lucky wrote:
hi guys,
i'm working on the context menu for the controls.
the problem i'm facing right now is like this :
i want to use one context menu for more then one controls lets say i
want to use one context menu for 3 treeview controls as 3 of them
shares same type of menu.
what i'm not able to do is, i can not idetify which control has invoke
the context menu's event. let say one of the treeview control has
invoke an event "Reset" from the context menu. all i need to do is, to
find out which treeview has invoked the event and needs to refill the
treeview control.

i tried to find out how to get the parent control but i failed to do
so.
In the ContextMenuStri p's Opening event, set a form-level private
variable to the ContextMenuStri p's SourceControl property. This is the
control that invoked the context menu. Then in the Reset item's handler,
you will be able to see who wants to be reset.

I wanted to avoid using a variable, and just put the SourceControl in
the *menu strip's* Tag property, but I couldn't work out how to get from
a ToolStripMenuIt em to its containing menu - can anyone enlighten me?
--
Larry Lard
la*******@googl email.com
The address is real, but unread - please reply to the group
For VB and C# questions - tell us which version
Aug 30 '06 #2
Private Sub ContextMenuStri p1_Opening(ByVa l sender As Object, ByVal e As _
System.Componen tModel.CancelEv entArgs) Handles ContextMenuStri p1.Opening

Debug.WriteLine (ContextMenuStr ip1.SourceContr ol.Name.ToStrin g)

End Sub
"Lucky" <tu************ @gmail.comwrote in message
news:11******** *************@i 3g2000cwc.googl egroups.com...
hi guys,
i'm working on the context menu for the controls.
the problem i'm facing right now is like this :
i want to use one context menu for more then one controls lets say i
want to use one context menu for 3 treeview controls as 3 of them
shares same type of menu.
what i'm not able to do is, i can not idetify which control has invoke
the context menu's event. let say one of the treeview control has
invoke an event "Reset" from the context menu. all i need to do is, to
find out which treeview has invoked the event and needs to refill the
treeview control.

i tried to find out how to get the parent control but i failed to do
so.

tools
c#.net 2.0 (VS.NET 2005)

can anyone give me any kind of suggestion on this.

thanks,
Lucky

Aug 30 '06 #3

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

Similar topics

1
3341
by: jinu | last post by:
Hello, My application loads with a form which is the mdi parent and a menu item click (main menu of the parent form) brings up a child form. I have to wait for a considerable amout of time to execute an oracle procedure which has to be invoked from the above said child form. The problem now is, during this waiting time, my mdi parent's menu is appearing to be not responding (becoming white in simple words). Once the oracle procedure is...
1
351
by: Ian | last post by:
I have a parent MDI with a menu that calls all the children forms and that works fine. My issue is I created a user control that looks like a toolbar and it has various windows controls on it and it will be used by all of the children forms. So I put the user control right underneath the menu control on the parent. Anytime I call a child form it fills the parent area including the area that the user control resides in. So I see the user...
0
2230
by: Karthick Kumar | last post by:
Hi, I need to create a simple parent/child hierarchical menu. I have alread used the Treeview control but my requirement is slightly different than the Treeview control. I already have the kind of menu I am talking about, written in Classic ASP, but I need to write the entire menu thing in Asp.Net using CSharp. I have a Sql table which has large number of menu items with problemId and parentId, through which I am trying to create and...
1
10209
by: scott | last post by:
Hi all, im not sure if this is possible but would be a grate help if it was. I have a several buttons and all have a context menu. That context menu has one menu item called delete. All context menus share the same click event. I want to be able to determine which button it has come from (get the
1
2721
by: Chris Murphy via DotNetMonster.com | last post by:
Hi all, I'm just wondering if any one can help me with this development issue I'm having. I've created a customized treeview control to handle the particular tasks to which I'll be using it. Within the control I'm dynamically creating a context menu and assigning it to the ContextMenu property of the control -- think of this like the default context menu for standard textboxes -- the context menu has a number of menu items that reflect...
4
3639
by: raj_genius | last post by:
I hav two queries, whc are as follows: FIRSTLY: is it possible to access the controls(by name) of a parent form(MDI) from its child forms??if yes then how??plzz provide a coded example in VB if possible.. for example..i hav a menu in the parent form named "Administrator" whic has an item "mnuLogIn"..now when i click on login..another child form named "frmLogIn" is displayed..what i want to happen is this: when login form(frmLogIn) is...
0
1730
by: Lucky | last post by:
hi guys, i'm working on the context menu for the controls. the problem i'm facing right now is like this : i want to use one context menu for more then one controls lets say i want to use one context menu for 3 treeview controls as 3 of them shares same type of menu. what i'm not able to do is, i can not idetify which control has invoke the context menu's event. let say one of the treeview control has invoke an event "Reset" from the...
0
1484
by: Newbie Coder | last post by:
I have added a context menu to a user control with just copy/paste on it. This is set for all areas of my user control, but when compiled, added to a Windows form the context menu doesn't show. Why? How do I allow my user control to only use the context menu I created in control's designer? In the Windows test app it shows the context menu property is none, but in the controls design view it shows it linked Using VB.NET 2003 not VB.NET...
5
2463
WebDunce
by: WebDunce | last post by:
hey all, i'm building a custom control. it contains a treeview and a context menu. each tree node's context menu property is set to the control's context menu. it works good...except... if after right-clicking on a tree node, if you decide NOT to use any of the options and click OFF of the tree view...the context menu disappears (great!) but then the control no longer seems to process key strokes. it's like the context menu, tho no...
0
8792
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9479
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9337
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8215
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4570
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4826
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3280
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 we have to send another system
2
2748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.