linking Form's ComboBox to DataGridViewComboBox

G

Guest

Hi, i have one question and one opinion i seek. please assist if you can.
I am using VS2005 beta.

1) I have two tables with the following columns
Security: security_id, name, symbol, exchange_id
Exchange: exchange_id, symbol, name
2) I have a Form that contains a combobox (cb1) and DataViewGrid (dg1).
3) The source for the DataViewGrid is the Security table and the source of
the combo box is the Exchange table
4) Before assigning the DataTable representing the Security table to
dg1.datasource, i remove the exchange_id column, and replace with
DataGridViewComboBoxColumn.
5) the properties for the DataGridViewComboBoxColumn are: DataPropertyName =
exchange_id, ValueMember = exchange_id, DisplayMember = "symbol", HeaderText
= "exchange". the DataSource is the ExchangeTable.
6) the source the Combox on the form is the same setup as that for the
DataGridViewComboBoxColumn
7) all this works fine...

QUESTION:
8) NOW, when i select a value in cb1, i would like the "exchange" column
(which is also a combobox) of ALL ROWS in the grid to reflect the value i
select (i.e. i want them all to change to what i select).
Currently i do this by using a foreach loop on the DataRows collection. i am
wondering if there is a more efficient way of doing this.
9) also, for some reason, although i believe i setup the
DataGridViewComboBoxColumn correctly, it does not show the "symbol" (even
though i have that set as the DisplayMember), it still shows the
"exchange_id". i believe this is because i am eating and error thrown by the
datagrid that states: "The value of the DataGridViewComboBoxCell is
invalid.".
I don't know why it is giving me this error. based on how i configured this
combobox, can anyone tell me why this is happening.

thank you much
 
G

Guest

Hello "dimension"

also I have found a similar problem, sent in this newsgroup today. If you
had to find a solution to the problem, I ask you to communicate it for
information to me.

Good job.

Dumbo
 

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