none
SelectedIndexChanged don't result when having single item in it. RRS feed

  • Question

  • Hello Community!

    I'm currently having problem with RadMultiColumnComboBox that when a single item exist in the ComboBox, and when it get selected by dropdown list, it don't fire and show the results. For Example, I have "1" as item in the ComboBox and when I choose the item from the list, it won't execute the further code against the index. 

    As my knowledge: There is single index in the ComboBox and as because the selected value is only item in the CB and index is not changed, so the rest code won't be executed.

    I need help, suggestions that what should i do?

    Friday, August 2, 2019 6:17 PM

Answers

  • I'm actually using Datasource in the CB and retrieving data using a query that i have some items with status "1" loaded in the query and when i select the item from the CB, it loads the data into fields and i update the data with status "2" so it hides from CB. As on, when last item left in CB, no index work to load the data of last item in CB. Code is shown below. I've also tried working with DropDownPopupClosed Event but NOT WORKING!

       
    Private Sub FwdDocQuery_DropDownClosed(sender As Object, args As RadPopupClosedEventArgs) Handles FwdDocQuery.DropDownClosed
            If Not String.IsNullOrWhiteSpace(FwdDocQuery.Text) Then
                Dim index As Integer = ApplicationsBindingSource.Find("ID", FwdDocQuery.Text)
                If index > -1 Then
                    ApplicationsBindingSource.Position = index
                End If
            End If




    Well it does not matter if the data comes from a query which tends to result to a DataTable in which case you would use DataTable.Rows.InsertAt in this case 0.

    But the real place to go if this is not helping you is to the vendor's forums.

    https://www.telerik.com/forums/winforms


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    • Marked as answer by AHM3DRAXA Monday, August 5, 2019 4:54 PM
    Friday, August 2, 2019 7:51 PM
    Moderator

All replies

  • Add a "Select" item so that the user must select the item.

    A super simple mockup to expand upon.

    Public Class Item
        Public Property Id() As Integer
        Public Property Name() As String
    
        Public Overrides Function ToString() As String
            Return Name
        End Function
    End Class
    

    Form

    ublic Class Form1
        Private Sub Form1_Load(sender As Object, e As EventArgs) _
            Handles MyBase.Load
    
            ComboBox1.DataSource = New List(Of Item) From
                {
                    New Item() With {.Id = 0, .Name = "Select"},
                    New Item() With {.Id = 1, .Name = "1"}
                }
        End Sub
    
        Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) _
            Handles ComboBox1.SelectedIndexChanged
    
            Dim item = CType(ComboBox1.SelectedItem, Item)
    
            If item.Id = 1 Then
                MessageBox.Show(item.Name)
            End If
        End Sub
    End Class


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Friday, August 2, 2019 6:44 PM
    Moderator
  • I'm actually using Datasource in the CB and retrieving data using a query that i have some items with status "1" loaded in the query and when i select the item from the CB, it loads the data into fields and i update the data with status "2" so it hides from CB. As on, when last item left in CB, no index work to load the data of last item in CB. Code is shown below. I've also tried working with DropDownPopupClosed Event but NOT WORKING!

       
    Private Sub FwdDocQuery_DropDownClosed(sender As Object, args As RadPopupClosedEventArgs) Handles FwdDocQuery.DropDownClosed
            If Not String.IsNullOrWhiteSpace(FwdDocQuery.Text) Then
                Dim index As Integer = ApplicationsBindingSource.Find("ID", FwdDocQuery.Text)
                If index > -1 Then
                    ApplicationsBindingSource.Position = index
                End If
            End If




    • Edited by AHM3DRAXA Friday, August 2, 2019 7:06 PM
    Friday, August 2, 2019 7:05 PM
  • I'm actually using Datasource in the CB and retrieving data using a query that i have some items with status "1" loaded in the query and when i select the item from the CB, it loads the data into fields and i update the data with status "2" so it hides from CB. As on, when last item left in CB, no index work to load the data of last item in CB. Code is shown below. I've also tried working with DropDownPopupClosed Event but NOT WORKING!

       
    Private Sub FwdDocQuery_DropDownClosed(sender As Object, args As RadPopupClosedEventArgs) Handles FwdDocQuery.DropDownClosed
            If Not String.IsNullOrWhiteSpace(FwdDocQuery.Text) Then
                Dim index As Integer = ApplicationsBindingSource.Find("ID", FwdDocQuery.Text)
                If index > -1 Then
                    ApplicationsBindingSource.Position = index
                End If
            End If




    Well it does not matter if the data comes from a query which tends to result to a DataTable in which case you would use DataTable.Rows.InsertAt in this case 0.

    But the real place to go if this is not helping you is to the vendor's forums.

    https://www.telerik.com/forums/winforms


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    • Marked as answer by AHM3DRAXA Monday, August 5, 2019 4:54 PM
    Friday, August 2, 2019 7:51 PM
    Moderator