当前位置:编程学习 > C#/ASP.NET >>

闰年查询VB源代码

Private Sub Command1_Click()
Dim a As Integer

a = Text1.Text

If (a Mod 400) = 0 Or ((a Mod 4) = 0 And (a Mod 100) <> 0) Then Label1.Caption = "闰年" Else Label1.Caption = "非闰年"

If a < 0 Then MsgBox ("不能为负数")


Set focus = Text1


End Sub




Private Sub Command2_Click()
End
End Sub

Private Sub Form_Activate()
Label4.Caption = Date
Label6 = Time
--------------------编程问答-------------------- --------------------编程问答-------------------- C#版。忘了闰年的具体定义了。只记得每四年一次。 --------------------编程问答--------------------
引用楼主 hpc_001 的回复:
Private Sub Command1_Click()
Dim a As Integer

a = Text1.Text

If (a Mod 400) = 0 Or ((a Mod 4) = 0 And (a Mod 100) <> 0) Then Label1.Caption = "闰年" Else Label1.Caption = "非闰年"

If a < 0 Then MsgBox ("不能为负数")


Set focus = Text1


End Sub


Private Sub Command2_Click()
End
End Sub

Private Sub Form_Activate()
Label4.Caption = Date
Label6 = Time
Command1 --------------------编程问答-------------------- 一直忘了判断闰年的条件,嗯,谢谢楼主分享,thx.. --------------------编程问答-------------------- 好象是能被4整除但是不能被100整除,和能被100整除并能被400整除!
估计网上很多吧,下一个OK的
--------------------编程问答-------------------- 这是c#版呀~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --------------------编程问答-------------------- ------------------------------------------------------------- --------------------编程问答-------------------- Private Function Pdrn(ByVal year As Integer) As Integer
    If (year Mod 4 = 0 AndAlso year Mod 100 <> 0) OrElse year Mod 400 = 0 Then
        Return 1
    Else
        Return 0
    End If
End Function --------------------编程问答-------------------- 楼上正解,顶一下
可惜我不会使用VB
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,