SmartParts collection containing non-smartparts

Topics: CAB & Smart Client Software Factory
Sep 11, 2006 at 6:19 PM
originally posted by: GregShaw

I have just solved an interesting problem.
I have a TabWorkspace to which I had added a TabPage in the designer. On this TabPage I had added a DataGridView. The other TabPages were added as SmartParts by a WorkItemController. I was having strange issues with the DataGridView and discovered that it had been added to the SmartParts collection in the WorkItem. I then realised that by adding the TabPage in the designer in didn't have a SmartPart attribute so the object builder took the first available component and added that.
The solution was to effectively remove the TabPage added through the designer and all its components and recreate it as a SmartPart view.
I now know I should've have added a static TabPage where dynamic SmartParts are expected but figured I would let others know and maybe raise a flag if someone believes there is a way to raise a runtime error if someone else tries this.

Thanks, Greg.