表A 有日期列,只要求输入年月,采用文本属性,掩饰码####-##为控制其有效性,表属性VALIDATEEDIT 代码如下:
If e.Col.Name = "日期" AndAlso e.Text <> Nothing Then
Dim ary As String() = e.Text.Split("-")
If ary.Length <> 2 Then
e.cancel = True
Else
If val(ary(1)) > 12 Then
e.Cancel = True
End If
End If
End If
此代码在表输入中控制有效,而建立窗口时,用TEXTBOX (掩码还是####-##)输入时,上代码控制无效,请教老师如何在窗口中也能控制其输入符合逻辑?
谢谢!!