views:

74

answers:

1

I have converted a VB6 application to VB.NET, because eventually I want to convert it to C#. But I have problems in regard of ShapeArray that inherits BaseControlArray. These are my problems :

I create a RectangleShapeArray class in the VB .Net solution. And then I converted to C#.

But when calling RectangleShapeArray.Load(1), it says that the rectangle shape array doesn't have an existing Shape to clone, and that I should have add a Shape to it at design time.

But I can't find a way to add a control to the RectangleShapeArray at design time. Is there a way to add a control to RectangleShapeArray at design time ?

Any help would greatly appreciated, thanks in advance ... :)

+2  A: 

But I can't find a way to add a control to the RectangleShapeArray at design time. Is there a way to add a control to RectangleShapeArray at design time ?

No. Control arrays are not supported by the .NET Windows Forms designer, which is a huge let-down for former VB6 programmers when they realize it first.

But if you really think about it, control arrays in the designer don't make much sense anyway: They are almost always dynamic, and use different numbers of controls depending on runtime constraints. Designing them at compile-time, then, doesn't make much sense.

Avoid control array classes in .NET completely, they are no longer necessary. If you have variable numbers of controls, use normal lists/arrays of controls instead (VB6 didn't support this because of the way VB6 implemented events). Inside the forms designer, only create static controls, not arrays of controls.

Konrad Rudolph