Search code examples
c#vb.netcomponentone

combobox's value item(checkbox) checkstate is neutral,how to correct it?


I am using component one's C1Combobox for filling products. This ComboBox contains 3 columns namely productid,product,select. The select column contains value item checkbox which is used to select products.

My problem is after filling this combobox, (the valueitem ie) checkbox select state is neutral.

How can i change the checkbox to uncheck immediately after filling the combobox

this is my code to fill combo

Private Sub fillcboProducts()
    Dim dt As New DataTable
    Dim strQry As String
    Try
        strQry = "select productid,product, '' as select from gtab04 "
        Dim da As NpgsqlDataAdapter = New NpgsqlDataAdapter(strQry, GenConnection)
        da.Fill(dt)
        If dt.Rows.Count > 0 Then
            cboProducts.DataSource = dt
            cboProducts.Columns(2).ValueItems.Presentation = C1.Win.C1List.PresentationEnum.CheckBox
            cboProducts.Splits(0).DisplayColumns(0).Visible = False
            cboProducts.Splits(0).DisplayColumns("product").Width = 408
            cboProducts.Splits(0).DisplayColumns("select").Width = 10
            cboProducts.Columns("select").Caption = ""
            cboProducts.Columns("product").Caption = "Product(s)"
            setCheckBox()
        Else
            GoTo quit
        End If
    Catch ex As Exception
        MsgBox(ex.Message, MsgBoxStyle.Information, "fillcboProducts")
    End Try
quit:
End Sub

and this is my output


Solution

  • Please refer this:

    EDIT What I understood from your requirements is that you want to uncheck all the checkboxes once the combobox is filled with items.

    Please note, this behavior is concurrent with windows. One has to manually uncheck all the checkboxes. However, if you wish to do it automatically, you can call a method which would separately uncheck all the checkboxes on button click.