PDA

View Full Version : unload array of combobox at run time



shamsam1
11-18-2008, 09:53 PM
in vb.6 at run time i am creating array of combo box and loading some values in it. on click event of first combo box i want to unload other comboboxs.

looking for vb.6 click event code for combobox

Bob Phillips
11-20-2008, 05:04 AM
Show us what code you have so far.

shamsam1
11-20-2008, 11:17 PM
Private Sub combo1_Click()

For j = form1.Label1().Count - 1 To 1 Step -1
Unload form1.Label1(form1.Label1().Count - 1)
Label1(0).Visible = False
Next j

For i = 0 To 10
If i <> 0 Then
Load Label1(i)
Label1(i).Left = 120
Label1(i).Move Label1(i).Left, Label1(i - 1).Top + 400
Label1(i).Visible = True

Load Combo1(i)
Combo1(i).Left = 1920
Combo1(i).Move Combo1(i).Left, Combo1(i - 1).Top + 400
Combo1(i).Visible = True
End If
Next i
end sub



If I execute the above code I got the following error
"Unable to unload within this context"

I know that is a vb error. It is not possible to unload anything on combo box click event. But I have to load combo boxes and labels at runtime and unload them

Please help me to achieve it