How do I loop through combobox items?

Posted by: fpulsi on 8 September 2017, 2:04 pm EST

  • Posted 8 September 2017, 2:04 pm EST


    how can i loop through all the items of a combobox? 

    I was able to create a combo box that the user can loop through using the spacebar, but I need to have it go back to the first item when the user presses the spacebar from the last item?



  • Replied 8 September 2017, 2:04 pm EST


    I think you can apply the same logic, that you have used to loop through ComboBox items using Spacebar but in reverse order. To loop through the Combobox items, you can use an array of String type and assign the Combobox items property to that string array.

    <blockquote>Dim combocell As New FarPoint.Win.Spread.CellType.ComboBoxCellType

    Dim mylist() As String

    ReDim mylist(dt.Rows.Count - 1)

    Dim row As DataRow

    Dim i As Integer

    For Each row In dt.Rows

    mylist.SetValue(row.Item(1), i)

    i += 1


    combocell.Items = mylist

    FpSpread1.Sheets(0).Columns(1).CellType = combocell</blockquote>


Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels