Connecting Tech Pros Worldwide Forums | Help | Site Map

PropertyGrid with ComboBox containing dynamic data

newbie
Guest
 
Posts: n/a
#1: Nov 15 '05
Hello,

I am using a propertygrid to allow users to edit\create objects at
runtime, that can update records in a database. There are certain
properties (fields) that I wish to display as comboboxs. Currently I
can create an enum, which the propertygrid displays as a combobox.
However since the comboxbox needs to be populated from a database
query, hardcoded enum's won't work. Is there a means with which to
create or define an enum at runtime? Or does anyone have sample code
on how to alter the behaviour of a propertygrid to display dynamiuc
data in a combobox?


newbie

Zürcher See
Guest
 
Posts: n/a
#2: Nov 15 '05

re: PropertyGrid with ComboBox containing dynamic data


You can set a table or array as DataSorce to the combobox
If you have inside a DataSet a Table ("comboboxtable") with two columns "id"
and "name",
you can do the following thing:

ComboBox.DataSource=DataSet.Table["comboboxtable"];
ComboBox.DisplayMember="name";
ComboBox.ValueMember="id";


"newbie" <ms_crack@yahoo.com> schrieb im Newsbeitrag
news:5145b334.0402020845.737b95a4@posting.google.c om...[color=blue]
> Hello,
>
> I am using a propertygrid to allow users to edit\create objects at
> runtime, that can update records in a database. There are certain
> properties (fields) that I wish to display as comboboxs. Currently I
> can create an enum, which the propertygrid displays as a combobox.
> However since the comboxbox needs to be populated from a database
> query, hardcoded enum's won't work. Is there a means with which to
> create or define an enum at runtime? Or does anyone have sample code
> on how to alter the behaviour of a propertygrid to display dynamiuc
> data in a combobox?
>
>
> newbie[/color]


Closed Thread