I am adding checkbox to datagridview.
how can I add a checkbox to the header so that when I click that all the checkboxes should be checked and corresponding rows should be deleted.. I am able to delete one row at a time. How to delete multiple rows..

DataGridViewCheckBoxColumn chkBoxColumn = new DataGridViewCheckBoxColumn();
              chkBoxColumn.Name = "CheckBoxes";

Deleting one row...

private void btnDelete_Click(object sender, EventArgs e)
            if (GlobalDataStore.GetInstance().CheckedStatus == true)
              string fName = GlobalDataStore.GetInstance().FirstName;
              string relation = GlobalDataStore.GetInstance().Relation;
              string idcardno = GlobalDataStore.GetInstance().Idcardno;
               string query = "DELETE  FROM DETAIL WHERE idcard_no = '" + idcardno.Trim() + "'" + " AND  FM_NAME = '" + fName.Trim() + "'" + " AND rln_fm_nm = '" + relation.Trim() + "'";
             DataSet ds = new DataSet();
             OracleDataAdapter da = new OracleDataAdapter(query, this.connection);
             DataTable dt = ds.Tables[0];
             DataRow dr = dt.NewRow();
             dr["View"] = "View";
             DataView my_DataView = dt.DefaultView;
             dataGridView1.DataSource = my_DataView;

Can anyone help me with the logic...


Some hints perhaps on how I would start to handle this problem:
Use the properties SelectedCells, SelectedColumns, SelectedRows and SelectionMode.
Make also use of the event MultiSelectChanged.
Example : Select the checkbox column, change one checkbox in it and change all the others in your code accordingly.
I have not worked this out, but if I would have to do this, this is what I should try. Hope it helps.

You need to look at the draw event most likely

sorry amn`t finish ur problem yet but u can use this :

CheckBox ck = new CheckBox();
ck.BackColor = Color.Transparent;

the u can do algorithm which u can put ur checkbox in ur certain header and do ur conditions .... after returning back i will do it .

BlackSun, smoking some of those funny sigarettes again?
It's all about the DataGridView and the DataGridViewCheckBoxColumn class.

ok man i don`t concentrate well :D
and i will not smoke those Cigarettes again