PC Review


Reply
Thread Tools Rate Thread

Fill collection property from a property grid

 
 
Vlado
Guest
Posts: n/a
 
      28th Mar 2006
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


 
Reply With Quote
 
 
 
 
Stoitcho Goutsev \(100\)
Guest
Posts: n/a
 
      28th Mar 2006
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?


--

Stoitcho Goutsev (100)

"Vlado" <(E-Mail Removed)> wrote in message
news:e0be36$d6s$(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
 
 
 
Vlado
Guest
Posts: n/a
 
      29th Mar 2006

"Stoitcho Goutsev (100)" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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?



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Collection problems (create Collection object, add data to collection, bind collection to datagrid) Øyvind Isaksen Microsoft ASP .NET 1 18th May 2007 10:24 AM
Collection problems (create Collection object, add data to collection, bind collection to datagrid) Øyvind Isaksen Microsoft Dot NET 1 18th May 2007 10:24 AM
Finding Grid Positions in a Property Grid James CC Microsoft C# .NET 0 30th May 2005 04:22 AM
Finding Grid Positions in a Property Grid James CC Microsoft Dot NET Framework Forms 0 28th May 2005 11:44 AM
Events Tab for Collection Editor Property Grid Jeremy Williams Microsoft Dot NET Framework Forms 0 30th Oct 2003 08:44 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:01 PM.