Valhalla Legends Forums Archive | .NET Platform | [C#]Menu

AuthorMessageTime
Mangix
im trying to create a menu with C# by using #develop but it doesnt let me.

the IDE lets me add items to a menu item but it doesnt let me specify the parent menu item. that sounds confusing so here's a screenshot.

http://img44.imageshack.us/img44/637/sdevelop7er.jpg

so does anyone know how i can make the ContextMenu thing have any text? i've tried editing the #develop generated text but i dont see anything for the context menu

edit: bah i solved it. seems i was using the wrong object -_-
September 14, 2005, 10:48 PM
Myndfyr
You needed to use a MainMenu instead of a ContextMenu.
September 14, 2005, 11:14 PM
Mangix
yeah i figured that out

but now i get a diffrent problem. im trying to make an event for one of the menu items but im having difficulty with it. the #develop IDE does it by doing [code]this.Load = System.EventHandler(this.MainFormLoad);[/code] but im having difficulty figuring out what to put in the EventHandler cause i dont see any option in the "this" object to handle Menu Events
September 14, 2005, 11:54 PM
Myndfyr
MenuItem events aren't handled via the Load event.  They're handled via the MenuItem.Click event:

[code]
this.menuItem1.Click += new EventHandler(menuItem1_Click);
[/code]
September 15, 2005, 12:45 AM
Mangix
that was a example for a Form's Load Event

i tried [code]this.mnuExit.Click += new System.EventHandler(mnuExit_Click);[/code] and got the error [quote]The name 'mnuExit_Click' does not exist in the class or namespace 'Mangix.MainForm'(CS0103)'[/quote]
September 15, 2005, 1:05 AM
Myndfyr
Did you create a function:
[code]
public void mnuExit_Click(object sender, EventArgs e) {}
[/code]
?
September 15, 2005, 2:54 AM
Mangix
just did and it fixed the error. thank you :)
September 15, 2005, 3:20 AM

Search