How to programatically pass an EventHandler as a parameter in a function

  • Thread starter Thread starter Silvers11
  • Start date Start date
S

Silvers11

Guest
Hello!

I wonder how it would be possible to pass along an argment(dataGridView_CellClick) in "createDataGridControlGUI(?)"

I have then programatically created: "dataGridView_CellClick" and now want to assign that eventhandler programatically in the function "createDataGridControlGUI".

I am not sure how to pass such parameter?


void createdatagridview()
{
createDataGridControlGUI(dataGridView_CellClick);
}
private void dataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
{
}
public void createDataGridControlGUI(System.Windows.Forms.DataGridViewCellEventArgs args)
{
DataGridView dgv = new DataGridView();
dgv.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(args); //dataGridView_CellClick
}

Continue reading...
 
Back
Top