参考:
库存明细表datacolchanged事件
If e.DataCol.Name = "型号" OrElse e.DataCol.Name = "颜色" Then
Dim dr As DataRow
dr = DataTables("库存").Find("[型号] = '" & e.DataRow("型号") & "' and 颜色='" & e.DataRow("颜色") & "'")
If dr Is Nothing Then
dr = DataTables("库存").AddNew
dr("型号") = e.DataRow("型号")
dr("颜色") = e.DataRow("颜色")
End If
End If