hi
i want to add check box in column header of gridview in windows form application please help me
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Midhun TpRank #388 · 6.5K reputationPosted Sep 19, 2016, 8:55 PM EDT
Midhun TpRank #388 · 6.5K reputationPosted Sep 19, 2016, 8:56 PM EDT
private void dataGridView1_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e) { CheckBox chBx = new CheckBox(); chBx.CheckAlign = ContentAlignment.MiddleCenter; chBx.Width = dataGridView1.RowHeadersWidth; chBx.Height = dataGridView1[0, e.RowIndex].Size.Height - 1; chBx.Location = new Point(1, ((e.RowIndex + 1) * chBx.Height - 1));//Location this.dataGridView1.Controls.Add(chBx); }or best solution is remove rowheaders and set first column to checkBoxColumn....private void Form1_Load(object sender, EventArgs e) { this.dataGridView1.RowHeadersVisible = false; this.dataGridView1.Columns.Insert(0, new DataGridViewCheckBoxColumn()); }Jisny AvRank #4,868 · 321 reputationPosted Sep 19, 2016, 9:27 PM EDT
Bikesh SrivastavaRank #108 · 20.3K reputationPosted Sep 19, 2016, 11:06 PM EDT