可以了,谢谢!
'新增行日期列不得早于上一行的日期
Select Case e.DataCol.Name
Case "日期"
Dim min As Date = e.DataTable.Compute("Min(日期)","企业名称 = '" & e.DataRow("企业名称") & "'")
Dim max As Date = e.DataTable.Compute("Max(日期)","企业名称 = '" & e.DataRow("企业名称") & "'")
If e.NewValue > min AndAlso e.NewValue < Max Then
Dim Result As DialogResult
Result = Messagebox.show("此日期不得早于本公司最后一行的日期,不得插入行或上下移动行! 请重新输入!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning)
If Result = DialogResult.OK Then
e.DataRow("日期") = Date.Today
End If
End If
End Select