If e.DataCol.Name = "输入" Then '如果是已结帐列的内容变动 If e.NewValue = True Then '而且变动后的值是True(已勾选) Dim dr As DataRow = DataTables("表A").Find("编码 = '" & e.DataRow("编码") & "'") If dr Is Nothing Then Dim dr1 As DataRow = DataTables("表A").AddNew For Each dc As DataCol In DataTables("表A").DataCols dr1(dc.Name) = e.DataRow(dc.Name) Next Else dr("数量") = dr("数量") + e.DataRow("数量") End If End If End If