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

but to add code not a control.

any ideas.

Recommended Answers

All 8 Replies

plz more clear.

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

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

Why not just use the DriveListBox???

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

And??? I'm still not understanding but good luck anyways...

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!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.