Create PixmapShape Instance in Class

Hi Everyone,

Having one of those brain-dead moments, and am asking for your help. How to instantiate a PixmapShape which is part of a class.

I have made a class called ‘AClass’ which has property ‘Car’ as a PixmapShape. How do I create an instance of car?

Tried this code and doesn’t work with the error ‘Syntax Error’:

Dim TempClass as new AClass 'Works good Dim TempClass.Car as new PixMapShape 'Syntax Error

Thanks for your help!

[quote=105818:@Eugene Dakin]Tried this code and doesn’t work with the error ‘Syntax Error’:

Dim TempClass as new AClass 'Works good Dim TempClass.Car as new PixMapShape 'Syntax Error[/quote]

Just assign the PixMapShape to the property; after all it is declared already in the class definition – no need for a Dim:

TempClass.Car = new PixMapShape

It could be argued that initialisation code such as this should be executed in a constructor method of the class.

Thanks Michael!

It works great.