答案 0 :(得分:0)
也许这已经很晚了,但请尝试将其添加到您的代码中:
Private Sub dg1_CellValueChanged(sender As Object, e As DataGridViewCellEventArgs) Handles dg1.CellValueChanged
Try
dg1.CommitEdit(DataGridViewDataErrorContexts.Commit)
If e.ColumnIndex = 9 Then 'columindex for your QUANTITY. 9 is just a sample
dg1.CommitEdit(DataGridViewDataErrorContexts.Commit)
dg1.CurrentRow.Cells("SubTotal").Value = (VAL(dgSalesOrderLine.CurrentRow.Cells("SalesOrderAmount").Value) * VAL(dgSalesOrderLine.CurrentRow.Cells("SalesOrderQuantity").Value))
End If
Catch ex As Exception
End Try
End Sub
Private Sub dg1_CurrentCellDirtyStateChanged(sender As Object, e As EventArgs) Handles dg1.CurrentCellDirtyStateChanged
dg1.CommitEdit(DataGridViewDataErrorContexts.Commit)
End Sub