2
Answers

how to make checkbox checked=true in datagrisview

hanafi tanudjaja

hanafi tanudjaja

16y
3.8k
1
 
hi there,
i have code ,i want  the every row under header Admin are checked

private void Form1_Load(object sender, EventArgs e)
        {
            string[] ug = { "Admin", "User" };
           
                for (int i = 0; i < ug.Length; i++)
            {
                dgv1.Columns.Add(new DataGridViewCheckBoxColumn());

                dgv1.Columns[i].Name = ug[i];
                dgv1.Columns[i].HeaderText = ug[i];
                dgv1.Columns[i].Width = 100;

                if (ug[i] == "Admin")
                {
                 // I want on every row checkbox checked=true here

                }
            }
        }

thank you and best regard
hanafi
Answers (2)