Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How can I reference the menu item I added at run-time?
Message
Information générale
Forum:
ASP.NET
Catégorie:
Menus
Divers
Thread ID:
00980910
Message ID:
00981015
Vues:
62
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

Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform