Click here to Skip to main content
15,887,175 members
Home / Discussions / C#
   

C#

 
QuestionIs it possible to call a control event inside another event? Pin
Member 1097549714-Dec-18 21:10
Member 1097549714-Dec-18 21:10 
AnswerRe: Is it possible to call a control event inside another event? Pin
OriginalGriff14-Dec-18 21:23
mveOriginalGriff14-Dec-18 21:23 
GeneralRe: Is it possible to call a control event inside another event? Pin
Member 1097549715-Dec-18 0:03
Member 1097549715-Dec-18 0:03 
AnswerRe: Is it possible to call a control event inside another event? Pin
Eddy Vluggen15-Dec-18 0:15
professionalEddy Vluggen15-Dec-18 0:15 
GeneralRe: Is it possible to call a control event inside another event? Pin
Member 1097549715-Dec-18 0:33
Member 1097549715-Dec-18 0:33 
GeneralRe: Is it possible to call a control event inside another event? Pin
Eddy Vluggen15-Dec-18 0:52
professionalEddy Vluggen15-Dec-18 0:52 
GeneralRe: Is it possible to call a control event inside another event? Pin
Member 1097549715-Dec-18 0:58
Member 1097549715-Dec-18 0:58 
GeneralRe: Is it possible to call a control event inside another event? Pin
Eddy Vluggen15-Dec-18 6:35
professionalEddy Vluggen15-Dec-18 6:35 
C#
private ContextMenuStrip contextMenuStrip1;

public Form1()
{
    InitializeComponent();
    dataGridView1.RowContextMenuStripNeeded += dataGridView1_RowContextMenuStripNeeded;
    dataGridView1.SelectionChanged += dataGridView1_SelectionChanged;

    contextMenuStrip1 = new ContextMenuStrip();
    contextMenuStrip1.Items.Add("The turtle moves.");
}

void dataGridView1_SelectionChanged(object sender, EventArgs e)
{
    DoMyBidding(null);
}

void dataGridView1_RowContextMenuStripNeeded(object sender, DataGridViewRowContextMenuStripNeededEventArgs e)
{
    e.ContextMenuStrip = contextMenuStrip1;
    int selectedrowindex = e.RowIndex; // why not dataGridView1.SelectedRows[0].Index?

    DoMyBidding(e.ContextMenuStrip);
}

void DoMyBidding(ContextMenuStrip humbly)
{
    // do whatever you normally do?
}
This is what Griff was explaining in sorts, before you stated it cannot be otherwise Smile | :)
Bastard Programmer from Hell Suspicious | :suss:
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

GeneralRe: Is it possible to call a control event inside another event? Pin
Member 1097549715-Dec-18 9:43
Member 1097549715-Dec-18 9:43 
GeneralRe: Is it possible to call a control event inside another event? Pin
Eddy Vluggen15-Dec-18 9:46
professionalEddy Vluggen15-Dec-18 9:46 
QuestionHow to make blood donation management system in C# windows forms? Pin
User-14714-Dec-18 5:21
User-14714-Dec-18 5:21 
AnswerRe: How to make blood donation management system in C# windows forms? Pin
Pete O'Hanlon14-Dec-18 5:23
mvePete O'Hanlon14-Dec-18 5:23 
AnswerRe: How to make blood donation management system in C# windows forms? Pin
OriginalGriff14-Dec-18 5:44
mveOriginalGriff14-Dec-18 5:44 
AnswerRe: How to make blood donation management system in C# windows forms? Pin
Luc Pattyn14-Dec-18 6:50
sitebuilderLuc Pattyn14-Dec-18 6:50 
Question(might be solved) need some ideas about licensing implementation Pin
Super Lloyd11-Dec-18 21:01
Super Lloyd11-Dec-18 21:01 
AnswerRe: need some ideas about licensing implementation Pin
Mc_Topaz13-Dec-18 3:11
Mc_Topaz13-Dec-18 3:11 
AnswerRe: (might be solved) need some ideas about licensing implementation Pin
BillWoodruff13-Dec-18 9:21
professionalBillWoodruff13-Dec-18 9:21 
GeneralRe: (might be solved) need some ideas about licensing implementation Pin
Super Lloyd13-Dec-18 12:51
Super Lloyd13-Dec-18 12:51 
AnswerRe: (might be solved) need some ideas about licensing implementation Pin
GenJerDan13-Dec-18 19:43
GenJerDan13-Dec-18 19:43 
GeneralRe: (might be solved) need some ideas about licensing implementation Pin
Super Lloyd13-Dec-18 22:22
Super Lloyd13-Dec-18 22:22 
QuestionRegarding Audio Player Format Pin
Member 1408628311-Dec-18 19:27
Member 1408628311-Dec-18 19:27 
AnswerRe: Regarding Audio Player Format Pin
OriginalGriff11-Dec-18 20:14
mveOriginalGriff11-Dec-18 20:14 
GeneralRe: Regarding Audio Player Format Pin
Nelek13-Dec-18 20:41
protectorNelek13-Dec-18 20:41 
AnswerRe: Regarding Audio Player Format Pin
jschell15-Dec-18 7:03
jschell15-Dec-18 7:03 
AnswerRe: Regarding Audio Player Format Pin
mtoha15-Jan-19 15:32
professionalmtoha15-Jan-19 15:32 

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.