📄 实验2.1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3090
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "总额"
Height = 495
Left = 720
TabIndex = 9
Top = 2400
Width = 1335
End
Begin VB.TextBox Text6
Height = 375
Left = 2760
TabIndex = 8
Top = 1680
Width = 855
End
Begin VB.TextBox Text5
Height = 375
Left = 2760
TabIndex = 7
Top = 1080
Width = 855
End
Begin VB.TextBox Text4
Height = 375
Left = 2760
TabIndex = 6
Top = 480
Width = 855
End
Begin VB.TextBox Text3
Height = 375
Left = 1560
TabIndex = 5
Top = 1680
Width = 855
End
Begin VB.TextBox Text2
Height = 375
Left = 1560
TabIndex = 4
Top = 1080
Width = 855
End
Begin VB.TextBox Text1
Height = 375
Left = 1560
TabIndex = 3
Top = 480
Width = 855
End
Begin VB.Label Label7
Height = 495
Left = 2880
TabIndex = 13
Top = 2400
Width = 1455
End
Begin VB.Label Label6
Caption = "数量"
Height = 255
Left = 2760
TabIndex = 12
Top = 120
Width = 975
End
Begin VB.Label Label5
Caption = "单价(元)"
Height = 255
Left = 1560
TabIndex = 11
Top = 120
Width = 975
End
Begin VB.Label Label4
Caption = "商品"
Height = 255
Left = 600
TabIndex = 10
Top = 120
Width = 615
End
Begin VB.Label Label3
Caption = "商品3"
Height = 255
Left = 600
TabIndex = 2
Top = 1680
Width = 855
End
Begin VB.Label Label2
Caption = "商品2"
Height = 255
Left = 600
TabIndex = 1
Top = 1080
Width = 855
End
Begin VB.Label Label1
Caption = "商品1"
Height = 255
Left = 600
TabIndex = 0
Top = 480
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
Private Sub Command1_Click()
Dim price1 As Single, price2 As Single, price3 As Single
Dim number1 As Single, number2 As Single, number3 As Single
Dim sum As Single
price1 = Val(Text1.Text)
price2 = Val(Text2.Text)
price3 = Val(Text3.Text)
number1 = Val(Text4.Text)
number2 = Val(Text5.Text)
number3 = Val(Text6.Text)
sum = price1 * number1 + price2 * number2 + price3 * number3
Label7.Caption = "总金额为:" & sum & "元"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -