Click here to Skip to main content
15,921,382 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a datagrid view with 3 columns for eg Name, Add, House-no already now i want to do so every time user click on add button it populate a grid view with this 3 columns plus one new column with check box??How i can do so???
Posted

1 solution

try this
C#
private void btnAdd_Click(object sender, EventArgs e)
        {
            dataGridView1.Columns.Clear();
            dataGridView1.Columns.Add("EName", "Name");
            dataGridView1.Columns.Add("Addr", "Addr");
            dataGridView1.Columns.Add("Hno", "H-No");
            DataGridViewCheckBoxColumn dgvCmb = new DataGridViewCheckBoxColumn();
            dgvCmb.ValueType = typeof(bool);
            dgvCmb.Name = "Column Name";
            dgvCmb.HeaderText = "CheckBox";
            dataGridView1.Columns.Add(dgvCmb); 
            
        }
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900