方法一:掩码 http://www.foxtable.com/webhelp/scr/0047.htm
方法二:在validateEdit写正则表达式判断,如
Dim pattern As String = "^[1-9]\d{3}-(0[1-9]|1[0-2]|[1-9])-(0[1-9]|[1-2][0-9]|3[0-1]|[1-9])$"
Dim txt As String= "2017-9-1" '2017年9月
Dim rgx = new System.Text.RegularExpressions.Regex(pattern, System.Text.RegularExpressions.RegexOptions.IgnoreCase)
If rgx.isMatch(txt) = False Then
msgbox("请输入正确的日期!")
Else
msgbox("正确")
End If