Click here to Skip to main content
15,921,606 members
Home / Discussions / C#
   

C#

 
GeneralRe: ListBox Pin
Rob Graham30-Oct-05 15:08
Rob Graham30-Oct-05 15:08 
QuestionExtending/Duplicating a Form Pin
Nkdnt29-Oct-05 17:32
Nkdnt29-Oct-05 17:32 
AnswerRe: Extending/Duplicating a Form Pin
S. Senthil Kumar29-Oct-05 19:12
S. Senthil Kumar29-Oct-05 19:12 
QuestionRe: Extending/Duplicating a Form Pin
MoustafaS29-Oct-05 19:36
MoustafaS29-Oct-05 19:36 
AnswerRe: Extending/Duplicating a Form Pin
Robert Rohde29-Oct-05 22:33
Robert Rohde29-Oct-05 22:33 
GeneralRe: Extending/Duplicating a Form Pin
MoustafaS30-Oct-05 16:27
MoustafaS30-Oct-05 16:27 
QuestionHow can I get info about which MenuItem that is clicked at runtime? Pin
M Shafaat29-Oct-05 14:11
M Shafaat29-Oct-05 14:11 
AnswerRe: How can I get info about which MenuItem that is clicked at runtime? Pin
Sean Michael Murphy29-Oct-05 16:23
Sean Michael Murphy29-Oct-05 16:23 
M Shafaat wrote:
But I don't find any way to retrieve any info telling me which specific MenuItem sends a click event at the moment. The sender and e parameters seem to carry some very general information, not from a specific MenuItem sending the click event.


No prob. You just have to cast the sender parameter to a MenuItem to get the info you want.

C#
this.mnuFileSave.Click += new System.EventHandler(this.MenuHandler);
this.mnuFileSaveAs.Click += new System.EventHandler(this.MenuHandler);
.
.
.
private void MenuHandler(object sender, EventArgs e) {
   MenuItem selectedMenu = (MenuItem)sender;

   switch (selectedMenu.Name) {
      case "mnuFileSave"      :
         MessageBox.Show(this, "Save selected");
         break;

      case "mnuFileSaveAs"    :
         MessageBox.Show(this, "SaveAs selected");
         break;
   }
}

Share and enjoy.
Sean
GeneralRe: How can I get info about which MenuItem that is clicked at runtime? Pin
Robert Rohde29-Oct-05 22:37
Robert Rohde29-Oct-05 22:37 
GeneralRe: How can I get info about which MenuItem that is clicked at runtime? Pin
M Shafaat30-Oct-05 8:35
M Shafaat30-Oct-05 8:35 
QuestionmciSendString and fullscreen Pin
Sasuko29-Oct-05 13:47
Sasuko29-Oct-05 13:47 
QuestionStrange Behaviour of an Object Pin
1nsp1r3d29-Oct-05 13:24
1nsp1r3d29-Oct-05 13:24 
AnswerRe: Strange Behaviour of an Object Pin
1nsp1r3d29-Oct-05 13:58
1nsp1r3d29-Oct-05 13:58 
QuestionOverwrite one section of binary file Pin
tommazzo29-Oct-05 12:11
tommazzo29-Oct-05 12:11 
AnswerRe: Overwrite one section of binary file Pin
Guffa29-Oct-05 12:27
Guffa29-Oct-05 12:27 
AnswerRe: Overwrite one section of binary file Pin
Dave Kreskowiak30-Oct-05 9:45
mveDave Kreskowiak30-Oct-05 9:45 
GeneralRe: Overwrite one section of binary file Pin
tommazzo30-Oct-05 12:36
tommazzo30-Oct-05 12:36 
QuestionHow to embed newline in a string resource? Pin
Rob Philpott29-Oct-05 8:43
Rob Philpott29-Oct-05 8:43 
AnswerRe: How to embed newline in a string resource? Pin
Judah Gabriel Himango29-Oct-05 15:08
sponsorJudah Gabriel Himango29-Oct-05 15:08 
GeneralRe: How to embed newline in a string resource? Pin
Rob Philpott30-Oct-05 4:59
Rob Philpott30-Oct-05 4:59 
QuestionHow to set limit to the bandwidth usage? Pin
dunbshy29-Oct-05 6:38
dunbshy29-Oct-05 6:38 
AnswerRe: How to set limit to the bandwidth usage? Pin
Dave Kreskowiak29-Oct-05 7:21
mveDave Kreskowiak29-Oct-05 7:21 
QuestionDelphi Dlls in C# Pin
Dave Shaw29-Oct-05 6:38
Dave Shaw29-Oct-05 6:38 
AnswerRe: Delphi Dlls in C# Pin
S. Senthil Kumar29-Oct-05 7:39
S. Senthil Kumar29-Oct-05 7:39 
GeneralRe: Delphi Dlls in C# Pin
Dave Shaw29-Oct-05 13:50
Dave Shaw29-Oct-05 13:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.