我已上传附件,点击出库窗口中的新增按钮时提示如下:
错误所在事件:表,出库明细,DataRowAdded
详细错误信息:
Exception has been thrown by the target of an invocation.
Object reference not set to an instance of an object.
————————————————————————————————————————————————————————————
新增按钮代码:
Dim sts() As String = {"出库日期"}
For Each st As String In sts
If e.Form.Controls(st).value Is Nothing Then '必填字段的判断
MessageBox.Show(st & "不能为空!","提醒",MessageBoxButtons.OK,MessageBoxIcon.None)
Return
End If
Next
Dim r1 As Row = Tables("出库").AddNew
Dim r As Row = Tables("出库明细").AddNew
For Each st As String In sts
If e.Form.Controls(st).value IsNot Nothing Then '日期?数字型在赋值空白时,会有1900-1-1以及0的值,做个判断,可以跳过
r1(st) = e.Form.Controls(st).value
r(st) = r1(st)
End If
Next
————————————————————————————————————————————————————————————————
表,出库明细,DataRowAdded 中的代码
Dim dr As DataRow = e.DataRow.GetParentRow("出库")
e.DataRow("出库日期") = dr("出库日期")
e.DataRow("摘要") = dr("出库类型")
[此贴子已经被作者于2021/5/14 17:17:57编辑过]