954,116 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Adding code to form using code

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

but to add code not a control.

any ideas.

drabsch
Light Poster
36 posts since Aug 2009
Reputation Points: 10
Solved Threads: 0
 

plz more clear.

abu taher
Practically a Posting Shark
845 posts since Jul 2008
Reputation Points: 14
Solved Threads: 78
 

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

drabsch
Light Poster
36 posts since Aug 2009
Reputation Points: 10
Solved Threads: 0
 

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.

jireh
Posting Whiz
316 posts since Jul 2007
Reputation Points: 11
Solved Threads: 49
 

ok thanks ill have a look at that

if there are any other ideas let me know

drabsch
Light Poster
36 posts since Aug 2009
Reputation Points: 10
Solved Threads: 0
 

Why not just use the DriveListBox???

vb5prgrmr
Posting Virtuoso
1,912 posts since Mar 2009
Reputation Points: 156
Solved Threads: 296
 

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

drabsch
Light Poster
36 posts since Aug 2009
Reputation Points: 10
Solved Threads: 0
 

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

vb5prgrmr
Posting Virtuoso
1,912 posts since Mar 2009
Reputation Points: 156
Solved Threads: 296
 

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!

crackerjacker
Junior Poster in Training
53 posts since Sep 2008
Reputation Points: 8
Solved Threads: 3
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You