PropertyGrid with ComboBox containing dynamic data

N

newbie

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

Zürcher See

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";
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top