Hello i have a datagridview with one bound combobox added by coding in form load and all other columns are unbound and created at design time. When i run the project, type in Unitprice column and then move to the next column by pressing tab key the "datagridviewcomboboxcell value is not valid" error appears. My coding of the project is here:
Private Sub CustomerBillForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim ProductCombo As New DataGridViewComboBoxColumn()
With ProductCombo
.HeaderText = "ProductID"
.Name = "ProductCombo"
.MaxDropDownItems = 4
.DataSource = ProductDataTable
.DisplayMember = "ProductName"
.ValueMember = "Productid"
.DisplayIndex = 0
.Width = 200
'.Items.Add("True")
'.Items.Add("False")
'.ValueType = TypeOf(Decimal)
BillGrid.Columns.Add(ProductCombo)
End With
end sub
Private Sub BillGrid_CellLeave(sender As Object, e As DataGridViewCellEventArgs) Handles BillGrid.CellLeave
Dim RowID As Integer = BillGrid.CurrentRow.Index
Dim ColID As Integer = BillGrid.CurrentCell.ColumnIndex
'BillGrid.Item(0, 0) = Convert.ToString(BillGrid.Columns("ProductName").v
If BillGrid.Item(ColID, RowID).ColumnIndex = 1 Or 2 Or 3 Then
BillGrid.Item(4, RowID).Value = (BillGrid.Item(1, RowID).Value - BillGrid.Item(3, RowID).Value) * BillGrid.Item(2, RowID).Value
End If
End Sub
please help .. i wasted hours on this ....