求一个判断是闰年的程序

来源:百度知道 编辑:UC知道 时间:2024/05/25 18:33:48
vb知识

'在文本框中输入年份,使用print输出是否为闰年。
Private Sub Command1_Click()
Dim i As Integer, s As Integer
s = Int(Text1.Text)
If s Mod 400 = 0 Or (s Mod 4 = 0 And s Mod 100 <> 0) Then
Print "闰年"
Else
Print "不是闰年"
End If
End Sub

Private Sub Command1_Click() '这个是
Dim IsLeap As Boolean
If IsNumeric(Text1.Text) = False Then
MsgBox "Input ERROR!" & vbCrLf & "Input again!", vbCritical, "Input ERROR!!!"
Exit Sub
End If
If Len(Trim(Text1.Text)) < 1 Then
MsgBox "You maybe forgot to input Year!" & vbCrLf & "Input again!", vbCritical, "Error Message!!"
Exit Sub
End If
If Len(Trim(Text1.Text)) > 4 Then
MsgBox "You maybe Input ERROR!" & vbCrLf & "Input AGAIN!", vbCritical, "Input ERROR!!!"
Exit Sub
End If
If IsDate("02/29/" & Text1.T