Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / March 2006

Tip: Looking for answers? Try searching our database.

Fill collection property from a property grid

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Vlado - 28 Mar 2006 14:35 GMT
VS2005 C#

I have something like this:

public class MyControl : Panel
{
       private SomeCollection myCollectionProp = new SomeCollection();
       public SomeCollection MyCollectionProp
       {
               get
               {
                       return this.myCollectionProp;
               }
       }
}

I put MyControl on a form (from toolbox). When I want to fill a
MyCollectionProp in a property grid I get message
"Object reference not set to an instance of an object." I can not figure
why.
Then, I tried to debug MyControl's design-time (Debug -> Attach to
Process... -> devenv) but when I try to open a collection editor from a
property grid, no exception is thrown and I can fill MyCollectionProp
normally. If I stop debugging and save changes and then start debug of
application everything works fine.

Can anyone explain what am I doing wrong and what is the difference between
normal design-time and design-time debug?

If that is some kind of bug maybe there is a workaround or should I create
my forms in design-time debug?

I hope you understand the problem. Any clue would be appreciated.

Vlado
Stoitcho Goutsev (100) - 28 Mar 2006 14:57 GMT
When this exception is thrown when you click on the ellipsis button for the
collection or when you click on the button to create new item for the
collection (inside the collection edtor)?

In other words - do you see the collection editor at all?

Signature

Stoitcho Goutsev (100)

> VS2005 C#
>
[quoted text clipped - 31 lines]
>
> Vlado
Vlado - 29 Mar 2006 08:22 GMT
> When this exception is thrown when you click on the ellipsis button for
> the collection or when you click on the button to create new item for the
> collection (inside the collection edtor)?
>
> In other words - do you see the collection editor at all?

No, I do not see the collection editor.

Funny thing is that this happens to me in editor inherited from UITypeEditor
also.
I made a dropdown style editor for one of my properties and it worked fine
in VS2003 but in VS2005 sometime I get exception "Object reference not
set..." when I click on the dropdown button in property grid. I have tried
with debugging the design time and I discovered that in
EditValue(ITypeDescriptorContext context, IServiceProvider provider, object
value)
method, parameter "context" is null.
I suspect that the same thing happens with the collection editor.

Any conclusions?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.