Dim dt As DataTable=Tables("kpinfo").DataTable
Dim dt1 As DataTable=Tables("ldinfo").DataTable
If dt.haschanges And dt1.haschanges Then
If MessageBox.Show("是否保存当前单据?","提示",MessageBoxButtons.YesNo,MessageBoxIcon.Information)=7 Then '如果按否则删掉本行数据
For Each dr As DataRow In dt.DataRows
For Each dr1 As DataRow In dt1.DataRows
If dr1.RowState=DataRowstate.added And dr.RowState=DataRowstate.added Then
dr.delete
dr1.delete
End If
Next
Next
Else '否则退回编辑界面
MessageBox.Show("请点击保存按钮保存","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Return
End If
End If
e.Form.close
Forms("windows").open
上述代码,为什么实现不了当提示是否保存,选择否时,删除“kpinfo”和“ldinfo”新增行,只会删除“ldinfo”表中的新增行。
敬请各位大师帮我看一下!谢谢了