一个textbox控件就足够了,你在textbox的lostfocus事件中写上: Private Sub text1_LostFocus() if trim(text1.text)="" then msgbox "请输入日期!",48,"提示" text1.setfocus else If not IsDate(text1.Text) Then msgbox "请输入日期型格式!",48,"提示" text1.setfocus else text1.text=format(text1.text,"yyyy-mm-dd") end if end if End Sub
Private Sub text1_LostFocus()
if trim(text1.text)="" then
msgbox "请输入日期!",48,"提示"
text1.setfocus
else
If not IsDate(text1.Text) Then
msgbox "请输入日期型格式!",48,"提示"
text1.setfocus
else
text1.text=format(text1.text,"yyyy-mm-dd")
end if
end if
End Sub