比如,validateEdit事件,写代码
If e.Col.Name = "日期" AndAlso e.Row.IsNull(e.Col.name) = False Then
If e.text = Nothing Then
e.cancel = True
Else
If Date.Today.day > 20 Then
Dim d As Date = e.Row(e.Col.name)
If format(d, "yyyyMM") < format(Date.today, "yyyyMM") Then
e.cancel = True
End If
End If
End If
End If