Good companions, it turns out that I'm doing a program in MS Visual Basic
where I have a checklistbox that is filled from a combobox , which according to what I choose in the combobox the list is generated in the checklistbox by clicking on a button, what I want to do now is that what I select in the checklistbox take out the names and put them in a listbox apart from what I have, is it possible to do this with a cycle ?, how could I do it ?.
I attach image of my form.
Button code generate list:
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
If comboescalafon.SelectedIndex = 0 Then
lista.Items.Add("kevin")
lista.Items.Add("jeison")
ElseIf comboescalafon.SelectedIndex = 1 Then
Button2.Enabled = True
lista.Items.Add("pablo")
lista.Items.Add("andres")
lista.Items.Add("douglas")
lista.Items.Add("chepo")
ElseIf comboescalafon.SelectedIndex = 2 Then
Button2.Enabled = True
lista.Items.Add("caralos")
lista.Items.Add("camila")
lista.Items.Add("jose")
lista.Items.Add("estela")
lista.Items.Add("harold")
lista.Items.Add("jhon")
ElseIf comboescalafon.SelectedIndex = 3 Then
Button2.Enabled = True
lista.Items.Add("felipe")
ElseIf comboescalafon.SelectedIndex = 4 Then
Button2.Enabled = True
lista.Items.Add("juan")
lista.Items.Add("manuel")
lista.Items.Add("gers")
ElseIf comboescalafon.SelectedIndex = 5 Then
Button2.Enabled = True
lista.Items.Add("juan")
lista.Items.Add("daniel")
ElseIf comboescalafon.SelectedIndex = 6 Then
Button2.Enabled = True
lista.Items.Add("alejandro")
ElseIf comboescalafon.SelectedIndex = 7 Then
Button2.Enabled = True
lista.Items.Add("homero")
lista.Items.Add("maguie")
lista.Items.Add("lissa")
ElseIf comboescalafon.SelectedIndex = 8 Then
Button2.Enabled = True
lista.Items.Add("bart")
End If
End Sub
I would like to add the functionality that I mention to you in the add button that is in my form.