在窗口中新增一行,保存,再新增一行,撤销
出现:新增的第二行删除,但新增且已保存的第一行"出库数量"清空,再撤销一次又有了
查看帮助的 Validating 事件,要把"撤销"按钮的"执行验证"属性设为False即可,但还是不管用
"出库数量"的 Validating代码为
Dim c As DataRow = Tables("出库").Current.DataRow
If c.RowState = DataRowState.added Then
If e.Form.Controls("出库数量").value > e.Form.Controls("库存数量").value Then
MessageBox.Show("出库数量大于库存数量")
e.Cancel = True
End If
End If
撤销的代码为
Dim c As DataRow = Tables("出库").Current.DataRow
If c.RowState = DataRowState.Added Then
c.Delete()
else
DataTables("出库").RejectChanges()
补充:只新增一行再撤销,没有问题
可能说的较乱,请大神帮忙,谢谢
[此贴子已经被作者于2014-3-7 20:53:57编辑过]