1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| Dim i As Integer = 0
Dim list = New List(Of ComboBox)
Dim selectedItem As Integer = Integer.Parse(Val(ComboBox4.SelectedItem.ToString))
Dim combo() As ComboBox
Dim lab() As Label
ReDim lab(selectedItem)
ReDim combo(selectedItem)
For i = 0 To selectedItem - 1
Dim c As New ComboBox
Dim l As New Label
l.Location = New Point(labelX, labelY + (i * 20))
l.Name = "label" & i.ToString
l.Width = 56
l.Height = 13
l.Left = 3
l.Text = "Elément"
c.Location = New Point(comboX, comboY + (i * 20))
c.Name = "Combobox" & i.ToString
c.Width = 156
c.Height = 21
c.Items.Add("test")
combo(i) = c
lab(i) = l
Next
Dim j As Integer = Val(combo.Count)
For i = 0 To j - 1
Me.Controls.Add(combo(i))
Me.Controls.Add(lab(i))
Next |
Partager