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

📄 f3-4.frm

📁 VB课程教学的讲义源的代码
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "例3-4 "
   ClientHeight    =   3090
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3090
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command5 
      Caption         =   "Y=""007"""
      Height          =   375
      Left            =   480
      TabIndex        =   10
      Top             =   2400
      Width           =   1695
   End
   Begin VB.CommandButton Command4 
      Caption         =   "Y=8.8"
      Height          =   375
      Left            =   480
      TabIndex        =   8
      Top             =   1920
      Width           =   1695
   End
   Begin VB.CommandButton Command3 
      Caption         =   "Y=X*3"
      Height          =   375
      Left            =   480
      TabIndex        =   6
      Top             =   1440
      Width           =   1695
   End
   Begin VB.CommandButton Command2 
      Caption         =   "X=X+1"
      Height          =   375
      Left            =   480
      TabIndex        =   4
      Top             =   960
      Width           =   1695
   End
   Begin VB.CommandButton Command1 
      Caption         =   "X=2"
      Height          =   375
      Left            =   480
      TabIndex        =   2
      Top             =   480
      Width           =   1695
   End
   Begin VB.Label Label5 
      Caption         =   "Label5"
      Height          =   375
      Left            =   2520
      TabIndex        =   11
      Top             =   2400
      Width           =   1695
   End
   Begin VB.Label Label4 
      Caption         =   "Label4"
      Height          =   375
      Left            =   2520
      TabIndex        =   9
      Top             =   1920
      Width           =   1695
   End
   Begin VB.Label Label3 
      Caption         =   "Label3"
      Height          =   375
      Left            =   2520
      TabIndex        =   7
      Top             =   1440
      Width           =   1695
   End
   Begin VB.Label Label2 
      Caption         =   "Label2"
      Height          =   375
      Left            =   2520
      TabIndex        =   5
      Top             =   960
      Width           =   1695
   End
   Begin VB.Label Label1 
      Caption         =   "Label1"
      Height          =   375
      Left            =   2520
      TabIndex        =   3
      Top             =   480
      Width           =   1695
   End
   Begin VB.Label Lbljieguo 
      Caption         =   "结果"
      Height          =   255
      Left            =   2880
      TabIndex        =   1
      Top             =   120
      Width           =   855
   End
   Begin VB.Label Lblfuzhi 
      Caption         =   "赋值"
      Height          =   255
      Left            =   960
      TabIndex        =   0
      Top             =   120
      Width           =   855
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim x%, y%      '模块级变量


Private Sub Command1_Click()
    x = 2 '把2赋给x
'把字符串“X=2”赋值给label1的Caption属性
    Label1.Caption = "X=" & x
End Sub

Private Sub Command2_Click()
    x = x + 1
    Label2 = "X=" & x
End Sub

Private Sub Command3_Click()
    y = x * 3
    Label3 = "Y=" & y
End Sub

Private Sub Command4_Click()
    y = 8.8 '单精度数赋给整型变量,四舍五入取整
    Label4 = "Y=" & y
End Sub

Private Sub Command5_Click()
    y = "007" '把数值形式的字符串转化为整型数值7,并赋值给y
    Label5 = "Y=" & y
End Sub

⌨️ 快捷键说明

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