creating objects at runtime in VB 5.0 
Author Message
 creating objects at runtime in VB 5.0

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



Tue, 11 Sep 2001 03:00:00 GMT  
 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



Tue, 11 Sep 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Creating object during RunTime with Visual Basic 5.0 CCE

2. Help: Creating Controls At Runtime With VB 5.0

3. ActiveX can't create object, Runtime 429 VB 6.0

4. Trying to access a DOM object created at runtime, VB - WebBrowser

5. How to import CArchive object from VC++ 5.0 to VB 5.0

6. Need Help Creating A Bitmap at runtime (in 5.0)

7. Severe Problem with objects containing Collections both in Scripting.Dictionary and VB 5.0 object

8. Activex Component Can’t Create Object - Runtime Error 429

9. Runtime error '429', ActiveX can't create object

10. Creating objects at runtime

11. Creating objects in runtime using the mouse??

12. Creating labels or other objects at runtime

 

 
Powered by phpBB® Forum Software