Ticket Q294689
Visible to All Users

RepositoryItemComboBox: how to obtain a selected index when an edit value is changed

created 14 years ago

Hi folks,
I have a grouping function on a ComboBoxEdit (code below). How do i transfer this to a RepositoryItemComboBoxEdit located on a Menubar (BarManager). I have read all articles and KB's but cannot get it working. I have tried the code at the end but not working.
    Private Sub cbEquipListGrouping_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cbEquipListGrouping.SelectedIndexChanged
        If cbEquipListGrouping.EditValue.ToString().IndexOf("----") >= 0 Then
            cbEquipListGrouping.SelectedIndex = cbEquipListGrouping.Properties.Items.Count - 1
        Else
            SetGroupIntervalEqList(cbEquipListGrouping.SelectedIndex)
        End If
    End Sub
    Private Sub SetIntervalEqList(ByVal column As GridColumn, ByVal interval As ColumnGroupInterval)
        column.GroupInterval = interval
        column.GroupIndex = 0
    End Sub
    Private Sub SetSortModeEqList(ByVal column As GridColumn, ByVal sortMode As ColumnSortMode)
        column.SortMode = sortMode
        column.GroupIndex = 0
    End Sub
    Private Sub SetGroupIntervalEqList(ByVal index As Integer)
        AdvBandedGridView2.BeginSort()
        Try
            AdvBandedGridView2.ClearGrouping()
            For Each column As GridColumn In AdvBandedGridView2.Columns()
                column.GroupInterval = ColumnGroupInterval.Default
                column.SortMode = ColumnSortMode.Default
            Next column
            Select Case index
                Case 0
                    SetIntervalEqList(colEnquiryPackage, ColumnGroupInterval.Value)
                    colSkidReference.GroupInterval = ColumnGroupInterval.Value
                Case 1
                    SetIntervalEqList(colSkidReference, ColumnGroupInterval.Value)
                Case 2
                    SetIntervalEqList(colEquipTag, ColumnGroupInterval.Value)
                Case 3
                    SetIntervalEqList(colSpecNo, ColumnGroupInterval.Value)
                Case 4
                    SetIntervalEqList(colLocation, ColumnGroupInterval.Value)
                Case 5
                    SetIntervalEqList(colPIDNo, ColumnGroupInterval.Value)
                Case 6
                    AdvBandedGridView2.CollapseAllGroups()
                    colSkidReference.SortOrder = ColumnSortOrder.Ascending
            End Select
        Finally
            AdvBandedGridView2.EndSort()
            AdvBandedGridView2.CollapseAllGroups()
        End Try
    End Sub
Tried Following Code (Not Working)

Private Sub BarEditItem1_ItemClick(ByVal sender As Object, ByVal e As ItemClickEventArgs) Handles BarEditItem1.ItemClick
        Dim val1 As Object = BarEditItem1.EditValue
        Dim selectedIndexInBar As String = RepositoryItemComboBox9.Items.IndexOf(val1)
        If BarEditItem1.EditValue.ToString().IndexOf("----") >= 0 Then
            val1.selectedIndexInBar = val1.Properties.Items.Count - 1
        Else
            SetGroupIntervalEqList(val1.selectedIndexInBar)
        End If
    End Sub
Any help appreciated.
Thanks,
Brian

Show previous comments (5)
BO BO
Brian O'Sullivan 14 years ago

    Hi Svetlana,
    That is perfect and working great.
    Many thanks,
    Brian

    DevExpress Support Team 14 years ago

      Hi Brian,
      Please do not hesitate to contact us in case of any difficulty. We will be happy to help you resolve any problem! :)
      Thanks,
      Svetlana

      BO BO
      Brian O'Sullivan 14 years ago

        Thanks a million

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.