⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 这是一个小的程序
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   4575
   ClientLeft      =   60
   ClientTop       =   390
   ClientWidth     =   7215
   LinkTopic       =   "Form1"
   ScaleHeight     =   4575
   ScaleWidth      =   7215
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton cmdCount 
      Caption         =   "计算"
      Height          =   495
      Left            =   2160
      TabIndex        =   5
      Top             =   2880
      Width           =   1215
   End
   Begin VB.CommandButton cmd 
      Caption         =   "日"
      Height          =   495
      Index           =   2
      Left            =   5160
      TabIndex        =   4
      Top             =   2760
      Width           =   1215
   End
   Begin VB.CommandButton cmd 
      Caption         =   "月"
      Height          =   495
      Index           =   1
      Left            =   5160
      TabIndex        =   3
      Top             =   1800
      Width           =   1215
   End
   Begin VB.CommandButton cmd 
      Caption         =   "年"
      Height          =   495
      Index           =   0
      Left            =   5160
      TabIndex        =   2
      Top             =   960
      Width           =   1215
   End
   Begin VB.TextBox txtBirth 
      Height          =   495
      Left            =   3240
      TabIndex        =   0
      Top             =   960
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "请输入年龄"
      Height          =   495
      Left            =   1440
      TabIndex        =   6
      Top             =   960
      Width           =   1215
   End
   Begin VB.Label lblDay 
      Height          =   495
      Left            =   2160
      TabIndex        =   1
      Top             =   1800
      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 cmd_Click(Index As Integer)
Select Case Index
Case 0:
 MsgBox Year(txtBirth.Text), vbOKOnly
Case 1:
 MsgBox Month(txtBirth.Text), vbExclamation + vbOKCancel
Case 2:
 MsgBox Day(txtBirth.Text), vbAboutRetryIgnore + vbDefaultButton2 + vbQuestion
 
End Select
 
End Sub

Private Sub cmdCount_Click()
If txtBirth.Text = "" Then
  MsgBox ("请输入你的出生日期!")
  txtBirth.SetFocus
Else
  If Not IsDate(txtBirth.Text) Then
    MsgBox ("请输入你的正确的出生日期!")
    txtBirth.Text = ""
    txtBirth.SetFocus
  Else
    lblDay.Caption = "你已出生" & DateDiff("d", txtBirth, Now) & "天!"
    Dim arr() As Integer
    ReDim arr(3) As Integer
    arr(0) = Year(txtBirth.Text)
    arr(1) = Month(txtBirth.Text)
    arr(2) = Day(txtBirth.Text)
    For i = 0 To 2
       cmd(i).Caption = arr(i)
       Next i
  End If
End If
End Sub

⌨️ 快捷键说明

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