Peter, thank you for your response,

I actually get the message, not as an exception, but in the property value
field of the Property Grid of the collection designer that pops up when the
user edits the ColorEntryCollection. It happens for all the properties of
the ColorEntry object (Color and Name) when I add an instance of the object
to the collection by pressing on the "Add..." button.
I hope that this provides some kind of insight on the problem. It should be
something for which the behavior in .NET 2.0 is slightly different than the
previous .NET 1.1 behavior, since in VS 2003 all worked fine.

TIA

    Uriel

On Tue, 19 Dec 2006 10:08:40 -0500, Peter Ritchie
<[EMAIL PROTECTED]> wrote:

>I assume the "Object does not match target type" is the Message property
>of a TargetException exception...
>
>This can occur during reflection when the framework is asked to invoke a
>method or constructor on an object where it thinks the object it is given
>is not an instance of the type in question.
>
>I can't offer any detail why the designer would cause this.  Could you
>provide more detail of the exception?  Does this occur as you add an item,
>during runtime, or do you get the lovely designer screen with the error at
>the top instead of the form?
>
>On Tue, 19 Dec 2006 02:33:27 -0500, Uriel Cohen <[EMAIL PROTECTED]>
>wrote:
>
>>I have an owner control that I wrote for .NET 1.1 and VS 2003 which
>>interacted with the designer. It actually allowed me to edit a collection
>>of ColorEntry instances. A ColorEntry instance is a (Color, string) pair,
>>i.e., a definition of a color and a name for it.
>>I actually created my own TypeConverter to transform it to text, something
>>like (Red; 255, 0, 0) , and my own Collection class to handle the
>>collection.
>>My control had a property which returned the collection with the
>attributes:
>>
>>[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
>>[Editor(typeof(ColorEntryCollectionEditor), typeof
>>(System.Drawing.Design.UITypeEditor))]
>>
>>So... everything worked fine in VS 2003. I had a collection editor that
>>allowed me to add new ColorEntry instances and to edit their Color and
>Name
>>properties.
>>
>>I used this control in a VS 2005 project (in .NET 2.0), and the problem
>>that I am having is that when I add a new instance of ColorEntry with the
>>ColorEntry Collection Editor (in the designer), I get the text
>>"Object does not match target type."
>>for both properties of ColorEntry (Color and Name), and I cannot edit
>>neither of them.
>>
>>Does anyone know of any functional changes (or API changes) in any of the
>>following classes that can explain the difference in behavior:
>>System.Drawing.Design.UITypeEditor
>>ExpandableObjectConverter
>>CollectionEditor     ?
>
>===================================
>This list is hosted by DevelopMentorĀ®  http://www.develop.com
>
>View archives and manage your subscription(s) at http://discuss.develop.com
===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to