Pass Value with Click event.
I am using cell click event and I would like to pass two more variable which are not available in the cell. How can I do that?
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
VulpesRank #55 · 29.2K reputationPosted Feb 21, 2014, 11:37 AM EST
The EventArgs parameter is just a shell and you have no control over what's passed when the context menu is clicked in any case.
Hemant SrivastavaRank #581 · 4.2K reputationPosted Feb 21, 2014, 6:13 AM EST
Which two variables ... are they in the same row ?
Is it dataGridView control of Winform?
Lio Liov44 reputationPosted Feb 21, 2014, 6:19 AM EST
Hemant SrivastavaRank #581 · 4.2K reputationPosted Feb 21, 2014, 6:37 AM EST
I'm not sure about the Infrgistic grid but on the regular dataGridView Control, you can get the other cell value in the following way:
dataGridView1[x,e.RowIndex].Value, where x is the column index of the other cell
Lio Liov44 reputationPosted Feb 21, 2014, 8:16 AM EST
I do have a ultragrid and I am assigniing to a cell of the grid this context menu.
I am trying to pass a variable from the same row to the OnClick method so I can access it inside OpenWith_OnClick.
contextMenu.MenuItems.Add("OpenWith",new System.EventHandler(OpenWith_OnClick));
private static void OpenWith_OnClick(object sender, System.EventArgs args)
{
MessageBox.Show("Test");
}