I am a little bit confused on how to apply the TypeConverter.
Just to restate what I am trying to do: (and so I can make sense of it as
well)
I have a custom control (ControlA)
I have a custom component (ComponentB)
I build both of them so they are designer aware and can be added to the
toolbox
ControlA derives from a TextBox
ComponentB derives from Component
ControlA has a property (PropertyC) that is of type ComponentB
In a separate solution I create a form
I place ControlA on the form
I place ComponentB on the form
I go to the property tab for ControlA and see that it has a PropertyC
I drop down the list and all that is there is (none)
I was hoping to see the name of an instance of ComponentB
I put [System.ComponentModel.TypeConverter(typeof(ComponentConverter))] as
an attribute of the property
Do I need to create a custom Converter?
Should I put the TypeConverterAttribute on the ComponentB class?
Am I even in the right ballpark?
Thanks for your help--
I'm joining this thread a little late, so I apologise if this solution has
already been dismissed.
Does your component inherit from System.ComponentModel.Component
If not does it implement IComponent.
If so then you do not need any attributes to get your property to behave as
you described.
As a simple example, add a UserControl to your project.
Add this code to the standard code already in the class.
\\\
private MyComponent componentProperty = null;
public MyComponent MyProperty
{
get
{
return componentProperty;
}
set
{
componentProperty = value;
}
}
///
now add a new Component (called MyComponent) to your project.
Build the project.
add an instance of the usercontrol and several instances of MyComponent to
your form.
your UserControls MyProperty should display (none) and in it's dropdown list
should be a list of all the MyComponent objects on the form.
no need for TypeConverters at all, unless your component class does not
implement IComponent.

Signature
Mick Doherty
http://dotnetrix.co.uk/nothing.html
>I am a little bit confused on how to apply the TypeConverter.
>
[quoted text clipped - 66 lines]
>>
>> John Saunders
ttupper - 28 Dec 2004 18:51 GMT
Thanks for making me take a step back and look at it on a simpler level.
I took your advice in combination with using the corect mix of design time
builds to make this work.
Thank you both for helping solve this problem.
> I'm joining this thread a little late, so I apologise if this solution has
> already been dismissed.
[quoted text clipped - 108 lines]
> >>
> >> John Saunders