Click here to Skip to main content
Sign Up to vote bad
good
Hi fellows. I have a DataGridView control with a CheckBoxColumn in it, and a CheckBox on the Header. There are some articles regarding this topic , but, i want the DataGridView to behave like i said in the Subject, like yahoo or gmail when you select the checkbox of an email and the corresponding row gets selected too.Does anyone have some clues regarding this?
 
Thanks in advance!!!
Posted 24 Jan '13 - 9:26
abel406269

Comments
Sergey Alexandrovich Kryukov - 24 Jan '13 - 16:13
What did you try? It looks trivial, as the selecting/selected events are available. —SA

1 solution

U can use below on form load event
DataGridViewCheckBoxColumn chk = new DataGridViewCheckBoxColumn();
chk.HeaderText = "Check Data";
chk.Name = "chk";
dataGridView1.Columns.Add(chk);
then on to change coor on checkbox click put code on cellmouseclick.
if (dataGridView1.Rows[e.RowIndex].Cells["chk"].Value == true)
{
       for(int i=0;i < dataGridView1.Rows[e.RowIndex].Cells.Count; i++)
       {
            dataGridView1.Rows[e.RowIndex].Cells[i].Style.BackColor = Color.Green;
       }
}
hope it helps u out.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 OriginalGriff 146
1 Richard MacCutchan 145
2 Sergey Alexandrovich Kryukov 134
3 Tadit Dash 134
4 Santhosh G_ 120
0 Sergey Alexandrovich Kryukov 10,348
1 OriginalGriff 7,965
2 CPallini 4,241
3 Rohan Leuva 3,522
4 Maciej Los 3,184


Advertise | Privacy | Mobile
Web01 | 2.6.130523.1 | Last Updated 28 Jan 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid