问题
I have a datagrid that consists of 3 comboboxcolumns and 2 textboxcolumns. I am loading my datagridview with data from the dataset. The data loads with an error always at the first combobox column.for each row,it displays the error and continues the load without issues. Error is :
DataGridViewcomboboxcell value is not valid.To replace this default dialog please handle in the DataError event
Can anyone explain why I have this error and how to overcome it?
sql = "Select Sequence, ValueDate, AcctID, TransCode, DorC, Amount, Currency, Description1, Description2, LocalEquivalent From tempentries where FCID = " & mdi.Ids.Text & " and transid = " & TransID.Text
da = New SqlDataAdapter(sql, UnauthCon)
da.Fill(ds, "TempEntries")
DGVTransactions.DataSource = ds.Tables("TempEntries")
DGVTransactions.Refresh()
I just found one thing, the combobox is retrieving account numbers from the account table. I have set the combobox property as follows:
columnaclase.DisplayMember = "AccountNo"
columnaclase.ValueMember = "AccName"
When I comment the valuemember
code, the load works fine.
Any idea why this is causing an error?
来源:https://stackoverflow.com/questions/17082721/datagridview-data-load-is-giving-error