'出库量大于库存量禁止出库
If e.DataCol.Name = "物料代码" Then '如果内容发生变动的是品名列
If e.NewValue Is Nothing Then '如果新值是空白,也就是品名列的内容为空
e.DataRow("出库数量") = Nothing '那么清空此行单价列的内容
End If
End If
Dim dg As DataRow = DataTables("库存材料表").Find("[物料代码] = '" & e.NewValue & "'","_Identify Desc")'获得最后一行
If dg IsNot Nothing Then '如果找到了同名的产品行,也就是dr不是Nothing
'e.DataRow("出库数量") = dg("库存数量")
If e.DataRow("出库数量") > dg("库存数量") Then
e.Cancel = True
MessageBox.Show("出库量大于库存量!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If
End If