Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a column(check Box) in DataGridView

Tags:

c#

windows

I have bound datagridview by datatable of Database on form Load in windows form application and I Want to add a column containing check box.. So whatever is showing can be checked.

like image 354
Meenakshi Moolani Avatar asked Jan 14 '23 15:01

Meenakshi Moolani


1 Answers

You can add easily DataGridViewCheckBoxColumn to your DataGridView Columns:

// Create new Checkbox Column
DataGridViewCheckBoxColumn myCheckedColumn = new DataGridViewCheckBoxColumn()
        {
            Name = "Checked Column", FalseValue = 0 , TrueValue = 1 , Visible = true
        };
// add the new column to your dataGridView 
myDataGridView.Columns.Add(myCheckedColumn);

I hope that helps you!

like image 110
SomeCode.NET Avatar answered Jan 16 '23 03:01

SomeCode.NET