Hi,
I generated columns from database and getting cell values from database too. my problem is that for some columns I have to generate checkbox in each cell at runtime.
I m using visual studio 2010.
Please Help

Thanks

Recommended Answers

All 2 Replies

This will generate a checkbox column in your datagridview:

Dim chkBoxCol As New DataGridViewCheckBoxColumn
        DataGridView1.Columns.Add(chkBoxCol)

Is this what was required ??
then by looping through all the checkboxes you can set value(s) accordingly.

'Below code will create checkbox column at last in datagrid with heading "Mark"

With datagridview_name

            Dim col As New DataGridViewCheckBoxColumn
            col.Name = "Mark"
            col.HeaderText = "Mark"
            col.TrueValue = 1
            col.FalseValue = 0
            col.FlatStyle = FlatStyle.Popup
            col.ReadOnly = False
            .ReadOnly = False
            .Columns.Insert(.Columns.Count - 1, col)

End With
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.