Hello,
I have a custom containercontrol “cc2” and i want to add instances of it with different values to window at runtime one at time vertically, each one below the previous one like a coloumn.
before adding containercontrol to the window i am assigning values to it’s properties .
but with this code only the first instance is being added .Can you please pointout where i went wrong.Thankyou
method-CalculateVerticalPosition(counter As Integer)
Return (Counter - 1) * 210
property-instanceCounter as Integer
CreateAndAddContainer(container As ContainerControl2)
Dim instanceCounter As Integer = 0
Dim containerArray() As ContainerControl2
You’re not creating a new instance of container every time? That would mean that every instance in ContainerArray and window1 would be pointing to the exact same container instance.
If you want an instance of an object, you have to create it either by dragging from the Library onto your layout (gives ypu one instance), or by using new. Just declaring a property which can hold a reference to the object gives you no instances at all. So:
Var myPtr as cc2 // Can hold a reference to an instance
myPtr = new cc2 // Creates an instance
By the way, if you post code here, please do this: