Dim dd As Table = Tables("订单表").Current
dd..GetChildRows("订单明细").Delete
试试:
Dim r As Row = Tables("订单表").Current
Dim Result As DialogResult
Result = MessageBox.Show("你还没有提交订单,关闭窗口会取消新增订单,是否关闭?", "提示", MessageBoxButtons.YesNo,MessageBoxIcon.Warning)
If Result = DialogResult.Yes Then
Dim drs As List(Of DataRow)
drs = DataTables("订单表").DataRows(0).GetChildRows("订单明细")
For Each dr As DataRow In drs
dr.Delete '删除订单明细表中的所有明细
Next
r.Delete() '删除订单表的当前行
Forms("新订单").Close()
End If
[此贴子已经被作者于2022/3/1 12:47:27编辑过]