In that case you need to use a collection or an array.
Here's an example using a collection:
VB Code:
'In General Declarations Dim myCombo as Collection 'in form load (or where you want!) Set myCombo = New Collection Dim combo_number as Integer For combo_number = 1 to 5 myCombo.add AddCombo(frame1,combo_number) Next combo_number 'your functions Private Function AddCombo(Parent_Control as object, line as Integer) as ComboBox Set AddCombo = Parent_Control.controls.add("Forms.ComboBox.1", "Combo" & line, true) End Function Private Sub CommandButton1_Click() ' This is where i am having problems Dim combo_number as Integer For combo_number = 1 to 5 myCombo(combo_number).Visible = False Next combo_number 'OR Dim tmpCombo For Each tmpCombo in myCombo tmpCombo.Visible = False Next tmpCombo : : End Sub




Reply With Quote