Ok i know now hot to use simple combobox in propertygrid
(see code below)
but how to add items with value
Mother=1,Sister =2
and when user select item from combobox i get valuemember not displaymember?
Mex
public class FamilyMember : Component
{
private string relation = "Unknown";
[TypeConverter(t ypeof(RelationC onverter)),Cate gory("Details")]
public string Relation
{
get { return relation; }
set { this.relation = value; }
}
}
internal class RelationConvert er : StringConverter
{
private static StandardValuesC ollection defaultRelation s =
new StandardValuesC ollection(
new string[]{"Mother", "Father", "Sister",
"Brother", "Daughter", "Son",
"Aunt", "Uncle", "Cousin"});
public override bool GetStandardValu esSupported(
ITypeDescriptor Context context)
{
return true;
}
public override bool GetStandardValu esExclusive(
ITypeDescriptor Context context)
{
// returning false here means the property will
// have a drop down and a value that can be manually
// entered.
return true;
}
public override StandardValuesC ollection GetStandardValu es(
ITypeDescriptor Context context)
{
return defaultRelation s;
}
}
"Redivivus" <me***********@ deltmar.eekirju tas sõnumis news:
Oc************* *@TK2MSFTNGP02. phx.gbl...
Hi
Ho to use dropdown in propertygrid with values from database?
Lets say i have table ITEMS
and columns ID, NAME
Now i want to select id, name from items
and display those values in dropdown of my propertygrid
Best regards;
Mex