【VB开源代码栏目提醒】:网学会员--在 VB开源代码编辑为广大网友搜集整理了:Ex2_2.frm绩等信息,祝愿广大网友取得需要的信息,参考学习。
VERSION 5.00
Begin VB.Form Ex2_2
Caption = "Form1"
ClientHeight = 3120
ClientLeft = 60
ClientTop = 450
ClientWidth = 2955
LinkTopic = "Form1"
ScaleHeight = 3120
ScaleWidth = 2955
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command3
Caption = "求a、b的和"
Height = 375
Left = 480
TabIndex = 2
Top = 2400
Width = 1695
End
Begin VB.CommandButton Command2
Caption = "交换a、b值"
Height = 375
Left = 480
TabIndex = 1
Top = 1800
Width = 1695
End
Begin
VB.CommandButton Command1
Caption = "显示a、b值"
Height = 375
Left = 480
TabIndex = 0
Top = 1080
Width = 1695
End
End
Attribute VB_Name = "Ex2_2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public sum As Integer
Private a As Integer, b As Integer '声明模块变量
Private Sub Command1_Click()
Dim i As Integer '声明局部变量
a = 10: b = 20
sum = a + b '求a、b的和
Print "当前a和b值为:"; a; b
i = a: a = b: b = i '变量交换
End Sub
Private Sub Command2_Click()
Print "a和b内容交换后:"; a; b '打印a、b交换后的结果
End Sub
Private Sub Command3_Click()
Print "a和b的和为:"; sum '打印a+b的值
End Sub