Click here to Skip to main content
15,888,984 members
Home / Discussions / C#
   

C#

 
GeneralRe: Interop call fails when ran from Scheduled tasks Pin
Hariharan.T6-Jul-09 0:53
Hariharan.T6-Jul-09 0:53 
QuestionHow to get Current User IP Address for my Intranet site Pin
kish205-Jul-09 23:12
kish205-Jul-09 23:12 
AnswerRe: How to get Current User IP Address for my Intranet site Pin
Dinesh Mani6-Jul-09 0:06
Dinesh Mani6-Jul-09 0:06 
AnswerRe: How to get Current User IP Address for my Intranet site Pin
Luc Pattyn6-Jul-09 0:14
sitebuilderLuc Pattyn6-Jul-09 0:14 
QuestionAjax collapsible Panel not working for Master page Pin
kish205-Jul-09 22:59
kish205-Jul-09 22:59 
AnswerRe: Ajax collapsible Panel not working for Master page Pin
Blue_Boy5-Jul-09 23:32
Blue_Boy5-Jul-09 23:32 
GeneralRe: Ajax collapsible Panel not working for Master page Pin
kish205-Jul-09 23:44
kish205-Jul-09 23:44 
QuestionProblem with dynamic array of ContextMenu Pin
Nigel Mackay5-Jul-09 22:47
Nigel Mackay5-Jul-09 22:47 
Hi
I have a grid with any number of rows. Each row has a picturebox drawn next to it.

The pictureboxes have context menu's assigned to them (5 menuitems).

Problem is, selecting an item from the contextmenu makes sender the contextmenu, so I don't know which row's picture box was right-clicked.

My code looks like this at the moment.

Declarations:
private ContextMenu[] mnuLamps;

I have a routine which creates the contextmenus's:
mnuLamps = null;
mnuLamps = new ContextMenu[dsSummary.Tables[0].Rows.Count];

for (int i = 0; i < dsSummary.Tables[0].Rows.Count; i++)
  {
     mnuLamps[i] = new ContextMenu();
     mnuLamps[i].MenuItems.Add(new MenuItem());
     mnuLamps[i].MenuItems[0].Text = "Receive";
     mnuLamps[i].MenuItems[0].Click += new EventHandler(ReceiveSelected);
     ... 
     mnuLamps[i].MenuItems.Add(new MenuItem());
     mnuLamps[i].MenuItems[4].Text = "Retract";
     mnuLamps[i].MenuItems[4].Click += new EventHandler(RetractSelected);
  }

When the pictureboxes are added to the form I have:
for (int i = 0; i &lt; dsSummary.Tables[0].Rows.Count; i++)
  {
    ...
    picBox[i].ContextMenu = mnuLamps[i];
    ...
  }

I then have ReceiveSelected, RetractSelected etc as:
private void ReceiveSlecetd(object sender, EventArgs e)

sender is of course menuitem, so I don't know which row it was.
I have thought of using
private void ReceiveSelected(object sender, EventArgs e, int TheRow)

and
mnuLamps[i].MenuItems[0].Click += new EventHandler(ReceiveSelected(mnuLamps[i], EventArgs, [i]);

so that I have access to the row, but I am having trouble doing the EventArgs and I am not sure I can use this code fiddling.

Thanks,
Nigel
AnswerRe: Problem with dynamic array of ContextMenu Pin
Luc Pattyn6-Jul-09 0:20
sitebuilderLuc Pattyn6-Jul-09 0:20 
QuestionPaging in datagridview Pin
Isaac Gordon5-Jul-09 22:12
Isaac Gordon5-Jul-09 22:12 
AnswerRe: Paging in datagridview Pin
dan!sh 5-Jul-09 22:17
professional dan!sh 5-Jul-09 22:17 
QuestionBest approach to use try catch finally Pin
Pankaj Saha5-Jul-09 21:03
Pankaj Saha5-Jul-09 21:03 
AnswerRe: Best approach to use try catch finally Pin
dan!sh 5-Jul-09 21:12
professional dan!sh 5-Jul-09 21:12 
GeneralRe: Best approach to use try catch finally Pin
Pankaj Saha5-Jul-09 21:36
Pankaj Saha5-Jul-09 21:36 
AnswerRe: Best approach to use try catch finally Pin
Alan N5-Jul-09 21:43
Alan N5-Jul-09 21:43 
AnswerRe: Best approach to use try catch finally Pin
Pete O'Hanlon5-Jul-09 22:06
mvePete O'Hanlon5-Jul-09 22:06 
GeneralRe: Best approach to use try catch finally Pin
Pankaj Saha5-Jul-09 22:38
Pankaj Saha5-Jul-09 22:38 
GeneralRe: Best approach to use try catch finally Pin
Pete O'Hanlon5-Jul-09 23:19
mvePete O'Hanlon5-Jul-09 23:19 
AnswerRe: Best approach to use try catch finally Pin
Luc Pattyn6-Jul-09 0:23
sitebuilderLuc Pattyn6-Jul-09 0:23 
GeneralRe: Best approach to use try catch finally Pin
PIEBALDconsult6-Jul-09 4:31
mvePIEBALDconsult6-Jul-09 4:31 
GeneralRe: Best approach to use try catch finally Pin
Luc Pattyn6-Jul-09 5:23
sitebuilderLuc Pattyn6-Jul-09 5:23 
QuestionError after selecting text in richtextbox Pin
Khawar Abbas15-Jul-09 20:50
Khawar Abbas15-Jul-09 20:50 
AnswerRe: Error after selecting text in richtextbox Pin
Alan N5-Jul-09 21:49
Alan N5-Jul-09 21:49 
AnswerRe: Error after selecting text in richtextbox Pin
Luc Pattyn6-Jul-09 0:26
sitebuilderLuc Pattyn6-Jul-09 0:26 
QuestionReport Viewer Control - Pin
devvvy5-Jul-09 20:25
devvvy5-Jul-09 20:25 

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.