473,549 Members | 2,784 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CollectionEdito r bug (repost)

<I've reposted this as it was slipping away over the horizon

Hi all,

I've been writing an application that uses a class object (call it Element) that I need to expose to the user at runtime for editing. To do this, I've been using the PropertyGrid control. The Element object has a collection property that contains references to other Elements (its purpose is to allow the users to generate XML schemas at runtime, in which elements can be nested to arbitrary depth). The PropertyGrid control opens an instance of the CollectionEdito r class when the user opens the collection property of a selected Element for editing. The CollectionEdito r class displays in its right panel another PropertyGrid for editing the properties of the selected colection member, and in its left panel has a listbox containing the members of the collection. One useful feature is that the user can add a new instance of the collection type (the default is Object) by clicking an Add button. This generates a new instance and adds it to the collection (in a rather complicated way, as it turns out). To support this, I've written a strongly-typed collection class for Element objects, so that the CollectionEdito r knows what type to generate, and what properties to display for editing

Here's the problem: When a user clicks "Add", a new instance of the collection type is added (which in this case also contains its own collection). If the user then goes to edit the collection property of the new instance, yet another Collection Editor pops up. The user can click "Add" in this window too, which will add a new child Element to the new Object's collection. In this way the user can "drill down", adding children to children, etc., with no apparent limit. The difficulty arises when the user decides to save, which involves clicking "OK" on the topmost CollectionEdito r window, then on the one below it, etc... However, although the topmost one closes just fine, the ones below pop up a messagebox saying "Error: Object reference not set to an instance of an object." This is not a standard system unhandled-exception popup, but seems instead to be some custom message, probably generated in a "catch" block somewhere in the editor source code. I have exhaustively examined my own code, put breakpoints everywhere, made sure that Element constructors are being called at each level, etc., but have found no problem. The CollectionEdito r seems to be doing alot of work behind the scenes over and above just adding/removing things from the existing collection, and the documentation of what it is doing seems to be nonexistent.

Sorry this was such a long-winded post, but it is a tricky thing to explain. Can anyone shed any light on this

Thanks, M

Nov 15 '05 #1
0 1210

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
492
by: m. pollack | last post by:
Hi all I've been using the PropertyGrid to allow the user to edit a class object at runtime. The class object contains a custom strongly-typed collection, and I have written a subclass of CollectionEditor to manipulate it, using an EditorAttribute on the collection class to associate the collection with my custom Editor subclass. The Collection...
0
1338
by: m. pollack | last post by:
<I've reposted this here as it was slipping away over the horizon on the C# group Hi all, I've been writing an application that uses a class object (call it Element) that I need to expose to the user at runtime for editing. To do this, I've been using the PropertyGrid control. The Element object has a collection property that contains...
0
1311
by: Buzz Bonner | last post by:
Hi, I need to perform some validation on the items inserted into the CollectionEditor. How can I override the CollectionEditor OK button so that the editor doesn't close if a validation error is raised?
0
1590
by: m. pollack | last post by:
Hi all I've been writing an application that uses a class object (call it Element) that I need to expose to the user at runtime for editing. To do this, I've been using the PropertyGrid control. The Element object has a collection property that contains references to other Elements (its purpose is to allow the users to generate XML schemas at...
0
1549
by: juststarter | last post by:
Hello all, here is my problem. I am using a property grid control (in a vb.net 2003 project) in which two properties are exposed : "editorStyle" and "events". The first property is used to select one of a series of web controls. The second one opens a collectioneditor which also exposes two properties : "event" and "command". The "event"...
0
1580
by: Andreas | last post by:
Hi! I'm using a custom collection with custom items to be edited with a custom CollectionEditor. This set of functionality is to be a part of a plugin for a SharpDevelop-based application. The strange thing now is that my derived CollectionEditor's SetItems method is called when testing the collection editing within a small test...
2
2372
by: Henry J. | last post by:
Has anybody run into this index out range exception when opening and then closing a collectionEditor from within a PropertyGrid? I use PropertyGrid to edit configurations in my application. One of the fields is a collection. I can expand or collapse the collection in the PropertyGrid fine. However,if I open the CollectionEditor...
0
1127
by: Bardo | last post by:
Hi all, I am having an issue with a custom CollectionEditor. My scenario is as follows: I have a base type TypeA. I also have a TypeACollection. The TypeACollection has an Editor attribute of TypeACollectionEditor. This collection editor derives from the framework CollectionEditor, passing TypeACollection in the constructor to indicate...
7
3791
by: colin | last post by:
Hi, I have my property editor wich uses the pop up collection editor for arrays etc, but i have had to use a generic wrapper for the elements in some types of collections. although the editing actually works well, and I can set the name ok in the primary property editor, this makes a mess of the type name displayed in the pop up colection...
0
7518
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7446
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7956
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7808
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5087
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3480
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1935
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1057
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.