cbm666吧 关注:221贴子:876
  • 9回复贴,共1

【CBM666 的润年与平年】

只看楼主收藏回复

一般被4整除的为润年 

但是...... 

被100整除而不能被400整除为平年, 能被100整除也可被400整除的为润年 


'添加 Text1

Private Sub Form_Load() 
Text1.Text = "2000" 
End Sub 

Private Sub Command1_Click() 
yearb = Val(Text1.Text) 
If (yearb Mod 4 = 0 And yearb Mod 100 <> 0) Or (yearb Mod 400 = 0) Then 
MsgBox "润年" 
Else 
MsgBox "平年" 
End If 
End Sub 



IP属地:四川1楼2007-05-05 10:54回复
    • 60.215.65.*
    正是我想要的,哈


    2楼2007-06-04 17:24
    回复
      我学的好像是“闰”年不是“润”年


      3楼2007-06-04 18:17
      回复
        If (yearb And 3) Or ((yearb Mod 400 = 0) Xor (yearb Mod 100 = 0)) Then
        MsgBox "平年"
        Else
        MsgBox "润年"
        End If


        4楼2011-04-03 12:43
        回复
          Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
          Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
          Private Const GWL_STYLE = (-16)
          Private Const ES_NUMBER = &H2000&
          Private Sub Form_Load()
          SetWindowLong Text1.hwnd, GWL_STYLE, GetWindowLong(Text1.hwnd, GWL_STYLE) Or ES_NUMBER 'Text1限制输入BUG
          End Sub
          *********************************************
          防止Text1中输入其他的东东 出现错误,呵呵


          IP属地:上海5楼2011-09-08 12:12
          回复
            这个我在ASP的程序中早就已经想到了,并且写成功了!


            IP属地:河北6楼2012-02-16 17:06
            回复
              msgbox iif(
              (yearb Mod 4 = 0 And yearb Mod 100 <> 0) Or (yearb Mod 400 = 0) ,"闰年","平年")


              IP属地:山东7楼2012-09-23 20:55
              回复
                好东东


                IP属地:广西来自手机贴吧8楼2012-10-28 11:48
                回复
                  Function IsLeap(sYear As String) As Integer
                  If IsDate("02/29/" & sYear) Then
                  IsLeap = True
                  Else
                  IsLeap = False
                  End If
                  End Function


                  IP属地:湖北9楼2013-01-14 23:44
                  回复
                    楼上,你源码都不发你有什么资格在这里说什么水平!
                    你幼儿园水平都没!有本事你上更好的。有本事吗?没对吧!你都没有发你 高水的源码。你有本事。你发、我看你水平有多高。


                    11楼2013-03-02 19:37
                    回复