473,386 Members | 1,621 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,386 software developers and data experts.

PopUpMenu - ContextMenu main menu item fails to call function

hi guys,
i have a problem with context menu's. actually what i'm
trying to do is to call the same function with the parent
item when clicked as well as sub items. it works for sub
menu item but fails for the parent menu item.

can someone please help me with this ....

thanx
-jasim

i'm attaching the code as well.

****************** Code ***********************

public void AddTAMenu()
{
try
{

DataSet ds = new DataSet();

ds.ReadXml("D:TA.xml");

DataTable dt1 = new DataTable();
dt1 = ds.Tables["TAClass"];

foreach (DataRow dr1 in
dt1.Rows)
{
string criteria;
criteria
= "TAClassID=" + dr1.ItemArray.GetValue(0).ToString();
MenuItem ClassItem
= new MenuItem(dr1.ItemArray.GetValue(1).ToString(),new
EventHandler(SelectValue));
foreach (DataRow
dr2 in
ds.Relations["class_generic"].ChildTable.Select(criteria))
{

ClassItem.MenuItems.Add(new MenuItem
(dr2.ItemArray.GetValue(2).ToString(),
new EventHandler(SelectValue)));

TANamepopUpMenu.MenuItems.Add
(dr2.ItemArray.GetValue(2).ToString(),new
EventHandler(SelectValue));
}

TAClasspopUpMenu.MenuItems.Add(ClassItem);
}
}
catch (Exception exp)
{

throw new Exception
("Search.AddTAMenu : " + exp.Message);
}
}

private void SelectValue(object sender, EventArgs e)
{
MenuItem miClicked = (MenuItem)
sender;
string item = miClicked.Text;
txtTA.Text =
miClicked.Text.ToString();
}

Jul 21 '05 #1
0 1408

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

Similar topics

2
by: VR | last post by:
I have a form with a list view control, a button control and a main menu with menuDelete item. Any time I am handling a button click event or menuDelete click event I call DeleteItem() function...
1
by: Brian Martel | last post by:
I am trying to create a dynamic flyout submenu off of a contextmenu. I can right click and get the base contextmenu ok. On the Popup event I add MenuItem's to the collection of one of the items so...
2
by: Derrick | last post by:
I've been working on an application which has a NotifyIcon (system tray icon), and a corresponding ContextMenu. I want to be able to update this menu dynamically. However, when I make changes to...
7
by: TryingLikeHeck | last post by:
I have a usercontrol on which I've generated a context menu in designer. The properties of the control lists for ContextMenu (none) The menu shows up in the designer window and I can edit it To...
5
by: Jorge Cavalheiro | last post by:
Hello I am trying to browse thru all menuitens of contextmenus. The form has 3 contextmenus. mi and mi2 as menuitems, f is a form For Each mi In f.ContextMenu.MenuItems For Each mi2 In...
0
by: Schorschi | last post by:
Ok the following works... but is ugly and static, need the same idea but dynamic, so as the 'theOwner' form main menu is defined, NotifyIcon.ContextMenu can be updated. Dim the0 As MenuItem =...
0
by: Jasim | last post by:
hi guys, i have a problem with context menu's. actually what i'm trying to do is to call the same function with the parent item when clicked as well as sub items. it works for sub menu item but...
11
by: Graham Charles | last post by:
I'm writing a control inheriting from ComboBox, and I'd like to add an entry to the ContextMenu for that combo box. I have no problem if I create an entirely new ContextMenu from scratch, but I'd...
3
by: asharda | last post by:
Hi, I am trying to create a context menu in my application. The context menu takes menu otems from an XML file. In XAML the code is <Grid.ContextMenu> <ContextMenu Name="cm" StaysOpen="true"...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
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...

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.