form1.frm

来自「Visual Basic程序设计视频教程」· FRM 代码 · 共 49 行

FRM
49
字号
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   3180
   ClientLeft      =   60
   ClientTop       =   360
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3180
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command1 
      Caption         =   "Command1"
      Height          =   495
      Left            =   1800
      TabIndex        =   0
      Top             =   1320
      Width           =   1215
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
    Dim Year As Integer
    Dim L As Boolean
    Year = Val(InputBox("请输入年份:", "润年判断"))

    '如果既能被100整除也可被400整除则L设置为True
    If (Year Mod 400 = 0) Then
        L = True
    '否则如果能被4整除但是不能被100整除L也设置为True
    ElseIf (Year Mod 4 = 0) And (Year Mod 100 <> 0) Then
        L = True
    '否则L为False
    Else
        L = False
    End If
    
    '输出闰年或平年
    If L = True Then
       MsgBox (Str(Year) + "年,您要求判断的年份是闰年")
    Else
       MsgBox (Str(Year) + "年,您要求判断的年份是平年")
    End If
End Sub

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?