472,353 Members | 1,886 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

CollectionEditor BUG

<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 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 CollectionEditor class when the user opens the collection property of a selected Element for editing. The CollectionEditor 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 CollectionEditor 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 CollectionEditor 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 CollectionEditor 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


Jul 21 '05 #1
0 1266

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

Similar topics

2
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...
2
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...
0
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"...
0
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...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...

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.