The combobox had datasource with displaymember and valuemember.
The problem is when i try to retrieve value from database and put it into the grid i get exception
System.FormatException : DatagridviewComboBoxCell value is not valid
I set the value using
For i = 0 To Dt_Edit.Rows.Count - 1
Try
Dg.Rows(i).Cells("txtAmount").Value = Dt_Edit.Rows(i)("Amount").ToString
CType(Dg.Rows(i).Cells("cmbAccount"), DataGridViewComboBoxCell).Value = CInt(Dt_Edit.Rows(i)("AcId").ToString)
Catch ex As Exception
End Try
Next
I have also tried
dg.rows(i).cells("cmbAccount").value = Dt_Edit.Rows(i)("AccountName").ToString()
but no luck.....
Please Help

New Topic/Question
Reply




MultiQuote




|