Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can I reference the menu item I added at run-time?
Message
General information
Forum:
ASP.NET
Category:
Menus
Miscellaneous
Thread ID:
00980910
Message ID:
00981015
Views:
60
From your original message, modify the following code:
>this.myMenuItem.MenuItems.Add(new System.Windows.Forms.MenuItem("Einar_0"));
>this.myMenuItem.MenuItems.Add(new System.Windows.Forms.MenuItem("Einar_1"));

Add two members to your form as follows:
public System.Windows.Forms.MenuItem oEinar_0;
public System.Windows.Forms.MenuItem oEinar_1;

//then:
this.oEinar_0 = new System.Windows.Forms.MenuItem("Einar_0");
this.oEinar_1 = new System.Windows.Forms.MenuItem("Einar_1");
this.myMenuItem.MenuItems.Add(this.oEinar_0);
this.myMenuItem.MenuItems.Add(this.oEinar_1);
//Then you refer it as 
if (this.oEinar_0.Checked) {//do something...}
Dawa Tsering


"Do not let any unwholesome talk come out of your mouths,
but only what is helpful for building others up according to their needs,
that it may benefit those who listen."

- Ephesians 4:29-30 NIV

Dare to Question -- Care to Answer

Time is like water in a sponge, as long as you are willing you can always squeeze some.

--Lu Xun, Father of Modern Chinese Literature

Previous
Next
Reply
Map
View

Click here to load this message in the networking platform