Combox query

0

Could someone help me hide the element of a ComboBox once they select it and not lose the internal index for the other elements?

My ComboBox I charge with the following method.

Private Sub ListarPeriodo()
    Dim _lista As New List(Of Integer)
    Dim producto As New Producto
    producto.Id = cmbProducto.SelectedIndex + 1

    Dim periodo As Integer = mgestorPeriodo.BuscarPeriodo(producto)

    For i As Integer = 0 To periodo - 1
        _lista.Add(i + 1)
    Next

    For Each i As Integer In _lista
        cmbPeriodo.Items.Add(i)
    Next
End Sub

I use the combo to load a certain number of numbers. When the user selects a certain number of this element, it must disappear and continue with the next number in the combo. But you should not lose the index, since when I record the object, it sends the index of each element.

    
asked by magi0 26.11.2016 в 15:38
source

1 answer

0

What you want is that when you select one of the values of the ComboBox, the selected value will be hidden once.

That is, if I select the value = VALOR B that its index is = 2 , that value = VALOR B should be hidden; and your other values and index should be maintained.

INDEX | VALOR
1       VALOR A
2       VALOR B
3       VALOR C
4       VALOR D
5       VALOR E

What you would do is remove the already selected value and keep the index of the value selected in order to manipulate or do what you want to do with that index, and then reload or refresh the ComboBox excluding the selected value. You can do it from the application or from the database, your select would be with a value in the where dynamically.

    
answered by 19.02.2017 в 08:14