Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim a As String
a = CDate(TextBox1.Text)
MsgBox("今年:" & Year(a))
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Dim a As String a = CDate(TextBox1.Text) if isdate(a) then MsgBox("今年:" & Year(a)) else MsgBox "请输入正确的日期" end if End Sub