Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to set a custom class as property of another custom class? 1

Status
Not open for further replies.

Paco75

Programmer
Oct 11, 2001
239
US
Hi,

I created a custom class and i want this class to contain an attribute that is also another custom class. I dont know how to achieve this in vfp.

Here is a sketch of what i want to do:

myCustomClass2 {
attribute1 type: string
}

myCustomClass1 {
classAttrib type: myCustomClass2
}
 
You've already done this many times, when creating a form, visually. As you put controls on a form. Those are no more and no less than subobjects of a form class.

So simply base your class on the container instead of the custom class, then you can drag the one into the other.

The Custom Class at least offers the AddObject() method, so you could also use This.AddObject("classAttribute","Class2") inside Class1 Init, to add Class2 as subobject.

Bye, Olaf.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top