I'm implemented a class called MyProvider which inherited from Component and
IExtenderProvider. i have the problem, that when I typed anything in the
visual studio designer in my MyItem-object which is provided by MyProvider,
the data is lost, after I clicked in another textbox. i added the following
methods in my provider:
[ProviderProperty("MyProvider", typeof(Control)]
public class MyProvider : Component, IExtenderProvider {
[ExtenderProvidedProperty]
[TypeConverter(typeof(MyItemConverter))]
public MyItem GetMyProvider(Control control) { }
[ExtenderProvidedProperty]
public void SetMyProvider(Control extendee, MyItem value) { }
public bool ShouldSerializeMyProvider(Control extendee) {}
}
my MyItem class has 4 properties. 2 of them are hidden for the designer
serialization.the last 2 properties are of type string.
any ideas why he deletes the entered data?
Nick Hounsome - 14 Mar 2006 09:40 GMT
> I'm implemented a class called MyProvider which inherited from Component
> and IExtenderProvider. i have the problem, that when I typed anything in
[quoted text clipped - 20 lines]
>
> any ideas why he deletes the entered data?
Because you are not saving it anywhere.
Let's see the actual method code.
Martin - 14 Mar 2006 10:27 GMT
Ok i found the bug... it was an oversight
in my Get method I created a new instance of my object and returned it. the
problem was that i didn't add the new instance to my internal collection.
but i have an onther problem too. when I'm trying to save the project with
my provider. I got an error "An error occurred while code generation for the
MyProvider-Property. the object rereference hasn't got a object instance."
maybe its a problem with my converter?
>> I'm implemented a class called MyProvider which inherited from Component
>> and IExtenderProvider. i have the problem, that when I typed anything in
[quoted text clipped - 23 lines]
> Because you are not saving it anywhere.
> Let's see the actual method code.