
creating objects at runtime in VB 5.0
Jesper,
I think that VB5 requires you to have one instance of an object on your
form at design time. Then you can add additional elements into a control
array of the objects at runtime. Try this:
At design time place a picturebox named picExample on your form. Set its
Index property to zero. Set its visible property to False.
Then, in a command button's click event:
Dim myIndex As Long
'get a new index number
myIndex = picExample.Count
'load a new element of the picturebox array
Load picExample(myIndex)
'reposition the new picturebox to the right of the previous one
picExample(myIndex).Left = picExample(myIndex - 1).Left +
picExample(myIndex - 1).Width
'make the new picturebox visible
picExample(myIndex).Visible = True
Run the program. Each time you click the command button you will load a
new element of the control array of pictureboxes.
Hope this helps,
Kerry Moorman
Quote:
> Could anybody help me with this?
> I have a standart exe program in which I want to create an object at
> runtime.
> f.eks. i you have a button, and when you press this button a picturebox,
> that diden't exist before occures (and when you press it again another
one
> occures. I HAS to be a new objekt, now just a hidden on becoming visible.
> if anybody could help me with this i would be very greatful.
> -Jesper