Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Property Sheet TypeConverter
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00766204
Message ID:
00766208
Vues:
41
Hi Cathi,

The DataSource property that I added is an object type, with simple get{} and set{} that do nothing more than get and set the private field. I didn't set it to type Employee, because I wanted something more generic.

My goal is to have some code that will read the DataSource and DataMember properties and do the DataBinding automatically.

The problem comes in setting the property via the property sheet. If I type Employee in the property sheet for the DataSource the resultant code in the Form.cs is

this.TextBox1.DataSource = "Employee"

what I would like is
this.TextBox1.DataSource = oEmployee

I would like to be either to type in the object name and not get the quotes, or have a drop down that shows the available objects. When I used the [TypeConverter("System.ComponentModel.ReferenceConverter")] attribute on the DataSource property, I get a list of all of the components on my form (textbox1, label1, etc). I understand that it is showing all of the controls that implement IControl. I'm trying to do something similar, and I don't know if I have to create my own TypeConverter or not, and if so, how to go about returning the correct value.

thanks,
bb

>Hi Bill,
>
>Can you provide some code for the DataSource property? Did you define the data type for the DataSource property to be Employee type?
>
>>Hi Cathi,
>>
>>I was hoping you could help me with this or point me in the right direction. I have created a subclass of the TextBox control in order to add a DataSource and DataMember property. When I set the DataSource property to oEmployee in the property sheet it is written to the code as "oEmployee" (with quotes). I would like to have the object reference (without the quotes) rather than a string. I think I need to the a TypeConverter Attribute, but I'm having trouble getting it to work.
>>
>>thanks,
>>bb
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform