Collection editor problem
-
Consider this. There's a custom control, MyCtl which displays a tree of items. It has a collection of MyItem objects. Both MyCtl and MyItem have item collections (that is, you can have sub-items, sub-sub-items, and so forth). The item collections in MyCtl and MyItem are marked as DesignerSerializationVisibility.Content, so that they are saved in the code when modified through the designer. Items can successfully be added to the item collection of the MyCtl control, through the designer (collection editor). When sub-items are added, with the Collection Editor, an "Object reference not set to an instance of an object" message comes up when OK is clicked and the sub-items are lost. :(( I've created a small test project to show you this behavior, along with a set of instructions, shown below. The ZIP file of the sample project is found at: http://www.dacris.com/collections.zip *ZIP file updated with VS.NET 2002 project files Here are the instructions: 1. Open the attached Zip file and extract it to an empty folder. 2. Open Collections.sln in the VS.NET IDE. 3. Build the solution to generate the Collections class library. 4. Open Form1.cs in the Windows Forms designer. 5. Select the control containing the tree of strings (it is set to DockStyle=Fill, so just click the form's client area). 6. Scroll the property grid all the way down. 7. Click the '...' button next to the Items collection property. 8. Select the third item in the list of items. 9. In the property grid for that item, select the '...' button next to the Items collection property. 10. Click the Add button on the dialog box that comes up. 11. Select the newly added item and enter a string value for the Text property (such as 'The disappearing item') in the property grid of the newly added item. 12. Click OK. Notice how the item has appeared on the control in the form, and it is called 'The disappearing item'. 13. Click OK again on the dialog box that remains. An "Object reference not set to an instance of an object" message should appear. Click OK. 14. Click Cancel. Another message will appear. Click OK to close it. 15. Click Cancel again. Notice how the item has now disappeared from both the control and the component tray, and the Form1 window is not marked as modified (asterisk). How can I get the items to persist on infinite depth levels? How on earth did MS do it with the TreeView and Menu controls? :confused: I am stuck and I need your help. I shal
-
Consider this. There's a custom control, MyCtl which displays a tree of items. It has a collection of MyItem objects. Both MyCtl and MyItem have item collections (that is, you can have sub-items, sub-sub-items, and so forth). The item collections in MyCtl and MyItem are marked as DesignerSerializationVisibility.Content, so that they are saved in the code when modified through the designer. Items can successfully be added to the item collection of the MyCtl control, through the designer (collection editor). When sub-items are added, with the Collection Editor, an "Object reference not set to an instance of an object" message comes up when OK is clicked and the sub-items are lost. :(( I've created a small test project to show you this behavior, along with a set of instructions, shown below. The ZIP file of the sample project is found at: http://www.dacris.com/collections.zip *ZIP file updated with VS.NET 2002 project files Here are the instructions: 1. Open the attached Zip file and extract it to an empty folder. 2. Open Collections.sln in the VS.NET IDE. 3. Build the solution to generate the Collections class library. 4. Open Form1.cs in the Windows Forms designer. 5. Select the control containing the tree of strings (it is set to DockStyle=Fill, so just click the form's client area). 6. Scroll the property grid all the way down. 7. Click the '...' button next to the Items collection property. 8. Select the third item in the list of items. 9. In the property grid for that item, select the '...' button next to the Items collection property. 10. Click the Add button on the dialog box that comes up. 11. Select the newly added item and enter a string value for the Text property (such as 'The disappearing item') in the property grid of the newly added item. 12. Click OK. Notice how the item has appeared on the control in the form, and it is called 'The disappearing item'. 13. Click OK again on the dialog box that remains. An "Object reference not set to an instance of an object" message should appear. Click OK. 14. Click Cancel. Another message will appear. Click OK to close it. 15. Click Cancel again. Notice how the item has now disappeared from both the control and the component tray, and the Form1 window is not marked as modified (asterisk). How can I get the items to persist on infinite depth levels? How on earth did MS do it with the TreeView and Menu controls? :confused: I am stuck and I need your help. I shal
-
It would help if I could open VS.NET 2003 beta files.....:( "I dont have a life, I have a program." Also, I won't support any software without the
LeppieRules
variable.