-
i want to create a control that has a dynamic array of picture boxes. i want to create new picture boxes dynamically until i don't need anymore. do you know how to access the index of the picture box control so that i can create new ones within the control?
-
just make the user control and drop a picture box on it
select the INDEX property of the picturebox and set it 0
select the VISIBLE property of the picturebox and set it FALSE
now you can add controls at run time by:
Code:
'use like this load picture1(x)
'create 10 pictureboxes
For counta = 1 to 10
Load Picture(counta)
Next
Just keep in mind that you never use picturebox(0) but use it as a template instead.
DocZaf
{;->
-
Just a quick note, when you run that you won't see it do anything, this is because all the new pictureboxes will have the same properties as the original, ie they are in the same place and are invisible, you have to make them visible to see them and if you are making lot's of them you have to move them all into position
I know it sounds obvious but it's a very easy thing to overlook, and a bit of a mare to sort out if you don't think of it.