|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Datagridview and comboxHELP!
I have a datagridview which I dragged to a C# form so bindings are all taken care of automatically. The grid shows all of my ros fine when I run it. Now I want to change a column to a combobox and bind it to a lookup table. Here is where the trouble starts. I set the datasource to the new table, datamember to the new field, etc. When I run it, I get error "datagridviewcombobox value not valid" or something close to that. I do not undertand why the drop down list does not work. Without it, I can edit the rows fine. Any help woudl be appreciated. I cannot find a simple solution for this - maybe one does not exist (a simple one). Chris,
In your datagridview, add an unbound column "collookup" ( or whatever you want to name it) Set the following properties for the new column added: Datasource: to the binding source of your lookup tableadapter Display Member : to whichever field in the lookup table you want to display ValueMember : to the field in the lookup table whose value you want to pass. DataPropertyName: to the field in table which is bound to the DGV and whose value matches with the field of the lookup table (basically the valuemember of your combobox) trust this helps. Show quote "Chris" <Ch***@discussions.microsoft.com> wrote in message news:D4AA9797-9D1D-4BF1-9AF1-682B07A74562@microsoft.com... > HELP! > > I have a datagridview which I dragged to a C# form so bindings are all > taken > care of automatically. The grid shows all of my ros fine when I run it. > > Now I want to change a column to a combobox and bind it to a lookup table. > Here is where the trouble starts. I set the datasource to the new table, > datamember to the new field, etc. When I run it, I get error > "datagridviewcombobox value not valid" or something close to that. I do > not > undertand why the drop down list does not work. Without it, I can edit the > rows fine. > > Any help woudl be appreciated. I cannot find a simple solution for this - > maybe one does not exist (a simple one). > > > |
|||||||||||||||||||||||