i need to add code to the form using code like the
Controls.Add().

but to add code not a control.

any ideas.

ok well i am making a loop that gets all the drives in a drive box and inserts a picbox and a label for each one.

because there can be a different a number of drives i want to add some code that will insert code (for when the label or picbox is clicked) in the loop

Edited 7 Years Ago by drabsch: n/a

you will add a code during runtime? I don't know it its possible but to make a work around on that... make a code/function that will be soon called of the control you will be going to add. You can try the AddHandler() method. Well I don't know it there's a AddHandler() method in VB6.

ok thanks ill have a look at that

if there are any other ideas let me know

because the program im making is to be like a sidebar but with all the drives instead of the gadgets.

and the list box is at the top and already opens the drive when i select one

ok i think i get it: make your picture box as an array, picture1(0), picture1(1) etc., then use this code

Load picture1(index)

then you can specify the location with

picture1(index).top = ...

i hope this helps!

This question has already been answered. Start a new discussion instead.