0

Hello,
I am having an issue trying to add a checkbox field to my DataGrid. I have the following Code but it does not display my checkbox. Any help is greatly appreciated.

Dim myconnection1 As New SqlConnection(myconn)
        Dim dtcCheck As New DataColumn("Select")
        dtcCheck.DataType = System.Type.GetType("System.Boolean")
        dtcCheck.DefaultValue = False
        Dim sa As New SqlDataAdapter("SELECT * FROM therapy", myconnection1)
        sa.Fill(ds, "Therapy")
        DataGridView1.DataSource = ds.Tables("Therapy")
        ds.Tables.Add.Columns.Add(dtcCheck)

Thank You

2
Contributors
1
Reply
3
Views
9 Years
Discussion Span
Last Post by ptaylor965
0

I used this code to create a table with each month as a checkbox

Dim chkBox As System.Type = System.Type.GetType("System.Boolean")
        With dtYear.Columns
            .Add("Jan", chkBox)
            .Add("Feb", chkBox)
            .Add("Mar", chkBox)
            .Add("Apr", chkBox)
            .Add("May", chkBox)
            .Add("Jun", chkBox)
            .Add("Jul", chkBox)
            .Add("Aug", chkBox)
            .Add("Sep", chkBox)
            .Add("Oct", chkBox)
            .Add("Nov", chkBox)
            .Add("Dec", chkBox)
        End With

Try using this syntax

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.