我有一个我无法弄清楚的问题。
我有一个 DataGridViewComboboxCell,
List<ComboBoxItem> klanten = new List<ComboBoxItem>();
foreach (ICustomer customer in CustomerFactory.CreateCustomers())
{
klanten.Add(new ComboBoxItem(customer.Naam, customer.Id));
}
klanten.Add(new ComboBoxItem("Klant aanvraag", -1));
uxInvoerenKlant.DataSource = klanten;
uxInvoerenKlant.DisplayMember = "Text";
uxInvoerenKlant.ValueMember = "Value";
When the option "Klant aanvraag" is selected the user gets a window where the user can choose another customer. 这是因为没有为该客户分配特定项目的用户。当用户选择一个时,它将在 Combobox 中使用以下代码进行更改。
uxUrenInvoeren[collumnIndex, row.Index].Value = uxInvoerenKlant.Items[klantIndex];
klantindex
是需要选择的客户,因为它是从组合框中检索的。在我看来,这是正确的对象。
在此之后,datagridview_dataerror
在我得到带有以下异常文本的 Format 异常的地方引发了事件。
DataGridViewComboBoxCell 值无效。
问题是什么?