Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
470
UltraComboEditor - select a row
posted

I have a UltraComboEditor with the following settings:

        cboConnections.CheckedListSettings.CheckBoxStyle = Infragistics.Win.CheckStyle.CheckBox
        cboConnections.CheckedListSettings.CheckBoxAlignment = ContentAlignment.MiddleLeft
        cboConnections.SortStyle = Infragistics.Win.ValueListSortStyle.Ascending

As data source I use a regular DataTable.

I initiate the datatable with this code:

        Dim col1 As New DataColumn("Id", GetType(String))
        Dim col2 As New DataColumn("Desc", GetType(String))
        Dim col3 As New DataColumn("ProtocolType", GetType(ConnectionClass.ProtocolT))
        Dim col4 As New DataColumn("SortDesc", GetType(String))
        DTConnections.Columns.Add(col1)
        DTConnections.Columns.Add(col2)
        DTConnections.Columns.Add(col3)
        DTConnections.Columns.Add(col4)

        Dim primarykey(0) As DataColumn
        primarykey(0) = col1
        DTConnections.PrimaryKey = primarykey

        cboConnections.DataSource = DTConnections

I am able to succefully check the checkboxes I want to check with this method:

    Friend Sub SetConnectionIds(l As List(Of String))
        For Each item As Infragistics.Win.ValueListItem In cboConnections.Items
            Dim drow As DataRowView = CType(item.ListObject, DataRowView)
            If l.Contains(item.DataValue.ToString) Then
                item.CheckState = CheckState.Checked
            Else
                item.CheckState = CheckState.Unchecked
            End If
        Next

        If cboConnections.Items.Count > 0 Then
            cboConnections.SelectedIndex = 0
        End If
    End Sub

The problem is the last part where I want to show (at least 1) row. I have tried setting SelectedIndex, SelectedItem and Value but all results in that the combo is empty. The right ones are checked in combo but nothing is selected which results in that I cannot get a quick overview if anything is checked at all. How can I solve this. I am using 14.1 version.