//Declaration public delegate void CellClickedEventHandler(object sender, DataGridViewCellEventArgs e); public event CellClickedEventHandler CellClicked; public delegate void CellDoubleClickedEventHandler(object sender, DataGridViewCellEventArgs e); public event CellDoubleClickedEventHandler CellDoubleClicked; //Functions private void CellClick(object sender, DataGridViewCellEventArgs e) { if (CellClicked != null) CellClicked(this, e); } private void CellDouClick(object sender, DataGridViewCellEventArgs e) { if (CellDoubleClicked != null) CellDoubleClicked(this, e); }
<datagridview name="">.CellClick += new DataGridViewCellEventHandler(CellClicked); <datagridview name="">.CellDoubleClick += new DataGridViewCellEventHandler(CellDoubleClicked);
Quote:Delegate to an instance method cannot have null 'this'
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)