listbox as variable?

Status
Niet open voor verdere reacties.

papeloppi

Nieuwe gebruiker
Lid geworden
4 mei 2009
Berichten
3
stel, ik heb (in vb6) 3 listboxen op een form, die gevuld zijn met gegevens.
is het mogelijk om 1 routine op een later te bepalen listbox toe te passen?
maw: kan een variabele als listbox worden gebruikt?
ik probeerde iets als onderstaand voorbeeld maar dit werkt niet...


DIM TheListBox as ListBox

If A = 1 Then
TheListBox = ListBox1
End If
If A = 2 then
TheListBox = ListBox2
End if
B = TheListBox.ListCount

ik hoop dat het een beetje duidelijk is, thx
mario
 
Code:
Dim TheListBox as [B]MsForms.[/B]ListBox

If A = 1 Then Set TheListBox = ListBox1
If A = 2 then Set TheListBox = ListBox2
B = TheListBox.ListCount

Wigi
 
dan krijg ik:

Compile error:
User-defined type not defined




m.
 
k heb het !!!


Dim TheListBox as string

if a = 1 then TheListBox = "ListBox1"
if a = 2 etc...

B = Controls.Item(TheListBox).ListCount - 1


thx again... bracht me in de goede richting :)
mario
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan