I’m attempting to use the code from http://www.codeproject.com/Articles/20165/CheckBox-Header-Column-For-DataGridView in order to add a CheckBox column to a DataGridView and have the header checkbox work so that I can just click that to check all the items.
When I attempt to follow the example I run across an issue “No overload for ‘cbHeader_OnCheckBoxClicked’ matches delegate ‘Solution.CheckBoxClickedHandler’
This seems to be a case where I’m attempting to put
cbHeader.OnCheckBoxClicked +=
new CheckBoxClickedHandler(cbHeader_OnCheckBoxClicked);
in the wrong place (I’m doing it when loading the data grid).
private void LoadDataGrid()
{
//initialize the checkbox column
DataGridViewCheckBoxColumn colCB = new DataGridViewCheckBoxColumn();
DatagridViewCheckBoxHeaderCell cbHeader = new DatagridViewCheckBoxHeaderCell();
colCB.HeaderCell = cbHeader;
int colCount = dataGridView1.Columns.Count;
//if we have no columns then add the one with checkboxes
if (colCount == 0)
{
dataGridView1.Columns.Add(colCB);
}
cbHeader.OnCheckBoxClicked +=
new CheckBoxClickedHandler(cbHeader_OnCheckBoxClicked);
//Add the data adapter stuff here
}
Any ideas where I’m going wrong here?
Thanks
You need to define a function with this signature in your class: