我的代码放到了全局项目事件beforesavedatarow里,意思是保存之前先检查是否有空值,但不起作用。代码如下:
With CurrentTable
For i As Integer = .TopPosition To .BottomPosition
Dim r As Row = .Rows(i)
Dim cls() As String
Select Case .DataTable.name
Case "Dwxx"
cls = New String(){"单位全称","单位简称"}
Case "Xcgl_jjd"
cls = New String(){"发放时间"}
Case "Xcgl_jjpf"
cls = New String(){"奖金名称","奖金类别","批复时间","批复金额"}
Case "Xcgl_kqtjb"
cls = New String(){"本月应出勤"}
Case "Xcgl_工资单"
cls = New String(){"身份证号"}
Case "员工信息表"
cls = New String(){"姓名","身份证号","员工类别"}
End Select
For Each c As String In cls
If r.isnull(c) Then
MessageBox.Show("[" & c & "]列不能为空!","提示",MessageBoxButtons.ok,MessageBoxIcon.warning)
'msgbox("[" & c & "]列不能为空!")
Return
End If
Next
Next
End With
[此贴子已经被作者于2019/9/4 17:08:09编辑过]