I have a e.g. class TestClass with several properties and constructors. The class has for example the property BackgroundColor As Color.
If I now have another class MyClass which have a property Fill As TestClass, is it possible and if so, how, to use MyClass.Fill = Color.Red which then automatically creates an instance of TestClass and sets the BackgroundColor to Color.Red?
Thanks
EDIT: I’ve created a small sample Project. Had no luck until now. Where am I wrong? I think it is about the fact that I will use several subclasses and the right one has to be assigned.
I’ve created a small sample Project. Had no luck until now. Where am I wrong? I think it is about the fact that I will use several subclasses and the right one has to be assigned.
Thanks Tim. You’re right. What I want is something like that:
I have a base class called Shading. There are Subclasses of Shading: ColorShading (with BackgroundColor As Color Property) & PictureShading (with BackgroundPicture As Picture Property). Now I simply want to do something like this for Shading instances:
Var shad As Shading ' Base Class.
shad = Color.Red ' Should return a ColorShading (Subclass of Shading) Instance.
' or
shad = MyPicture ' Should return a PictureShading (Subclass of Shading) Instance.
Yes I did, but since I have a structure with couple of subclasses, I hadn’t any success until now. Please have a look at my forth post here with more details.