1)如何访问以下代码创建的组合,并在点击combo5.Backcolor = vbgreen
后设置button1
2)点击combo5.Backcolor
vbgreen
设置为combo5
3)如何在创建特定组合后将项添加到组合(即combo.Items.Add
)
Private Sub CreateComboArray(ByVal number As Integer, ByVal container As Control)
Dim previouscombowidth As Integer = 0
Dim position As Integer = 7
Dim combo As ComboBox
For i As Integer = 0 To number - 1
combo = New ComboBox()
combo.Name = "combo" + i.ToString()
combo.Items.Add(RichTextBox1.Text.Split(" ")(i))
combo.SelectedIndex = 0
container.Controls.Add(combo)
combo.Height = 22
combo.Width = (5 * combo.SelectedItem.ToString.Length) + 10
If i > 0 Then
position += previouscombowidth + 3
End If
combo.Left = position
combo.DropDownStyle = ComboBoxStyle.Simple
previouscombowidth = combo.Width
Next
End Sub