0

Hi, I have 2 tables:
Payment (PaymentId, Date, Description, Amount, PaymentMethodId)
PaymentMethod (PaymentMethodId, Description)

The first table contains details of any Payments that we receive and is displayed in the datagridview.
The second is a lookup table which lists the methods of payment (ie. cash, cheque, credit card) and should appear as a combobox in the grid.

As you can see there is a foreign key (PaymentMethodId) between the two tables.

I'm binding the DataGridViewComboBoxColumn as follows:
comboboxColumn.DataSource = myDataset.PaymentMethod;
comboboxColumn.ValueMember = "PaymentMethodId";
comboboxColumn.DisplayMember = "Description";

Then adding it to the grid. But when the grid displays I receive the following data error "DataGridViewComboBoxCell value is not valid" and the cell value contains the Id (such as 1) rather than the Description (such as "Cash").

Any ideas what I'm doing wrong?

I have the same Problem But The Tables Are Different
Please Have time to view the part sample code

Also I provided The Error As An img

Thanks in advance

1
Contributor
1
Reply
2
Views
8 Years
Discussion Span
Last Post by Eyo
0

Hi, I have 2 tables:
Payment (PaymentId, Date, Description, Amount, PaymentMethodId)
PaymentMethod (PaymentMethodId, Description)

The first table contains details of any Payments that we receive and is displayed in the datagridview.
The second is a lookup table which lists the methods of payment (ie. cash, cheque, credit card) and should appear as a combobox in the grid.

As you can see there is a foreign key (PaymentMethodId) between the two tables.

I'm binding the DataGridViewComboBoxColumn as follows:
comboboxColumn.DataSource = myDataset.PaymentMethod;
comboboxColumn.ValueMember = "PaymentMethodId";
comboboxColumn.DisplayMember = "Description";

Then adding it to the grid. But when the grid displays I receive the following data error "DataGridViewComboBoxCell value is not valid" and the cell value contains the Id (such as 1) rather than the Description (such as "Cash").

Any ideas what I'm doing wrong?

I have the same Problem But The Tables Are Different
Please Have time to view the part sample code

Also I provided The Error As An img

Thanks in advance

It Seems No solution for this prblm...
Maybe its grdView Itself....

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.