📄 例10.frm
字号:
VERSION 5.00
Begin VB.Form FRM6_5_9
Caption = "工资输入系统"
ClientHeight = 4905
ClientLeft = 60
ClientTop = 450
ClientWidth = 5610
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form5"
ScaleHeight = 4905
ScaleWidth = 5610
StartUpPosition = 3 '窗口缺省
Begin VB.PictureBox Picture1
Height = 2055
Left = 480
ScaleHeight = 1995
ScaleWidth = 4635
TabIndex = 9
Top = 2640
Width = 4695
End
Begin VB.CommandButton Command3
Caption = "统计"
Height = 615
Left = 3840
TabIndex = 8
Top = 1800
Width = 1335
End
Begin VB.CommandButton Command2
Caption = "插入"
Height = 615
Left = 2160
TabIndex = 7
Top = 1800
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "追加"
Height = 615
Left = 480
TabIndex = 6
Top = 1800
Width = 1335
End
Begin VB.TextBox Text3
Height = 615
Left = 3840
TabIndex = 5
Top = 960
Width = 1335
End
Begin VB.TextBox Text2
Height = 615
Left = 2160
TabIndex = 4
Top = 960
Width = 1335
End
Begin VB.TextBox Text1
Height = 615
Left = 480
TabIndex = 3
Top = 960
Width = 1335
End
Begin VB.Label Label3
Alignment = 2 'Center
Caption = "工资"
Height = 375
Left = 3960
TabIndex = 2
Top = 240
Width = 1095
End
Begin VB.Label Label2
Alignment = 2 'Center
Caption = "职称"
Height = 375
Left = 2280
TabIndex = 1
Top = 240
Width = 975
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "姓名"
Height = 375
Left = 600
TabIndex = 0
Top = 240
Width = 1095
End
End
Attribute VB_Name = "FRM6_5_9"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Base 1
Dim empwage() As StrEmployee, intcurr As Integer, i As Integer, sum As Integer
Private Sub Command1_Click() ' 追加事件过程
If Text1 <> "" Then
i = i + 1 ' 数组元素增加1个
ReDim Preserve empwage(i) ' 重定义数组,保持原数据不变
With empwage(i)
.name = Text1: .title = Text2: .wage = Val(Text3)
End With
Text1 = "": Text2 = "": Text3 = ""
Else
MsgBox ("在追加前请先输入数据")
End If
End Sub
Private Sub Command2_Click() ' 插入事件过程
intcurr = CInt(InputBox("输入插入位置"))
If intcurr <> 0 And intcurr <= i And Text1 <> "" Then
i = i + 1 ' 数组元素增加1个
ReDim Preserve empwage(i) ' 重定义数组,保持原数据不变
For j = i To intcurr + 1 Step -1: empwage(j) = empwage(j - 1): Next
With empwage(intcurr)
.name = Text1: .title = Text2: .wage = Val(Text3)
End With
Text1 = "": Text2 = "": Text3 = ""
Else
MsgBox ("在插入前请先输入数据")
End If
End Sub
Private Sub Command3_Click() ' 统计事件过程
sum = 0
If i > 0 Then
For m = LBound(empwage) To UBound(empwage)
sum = sum + empwage(m).wage
Next
Picture1.Print "工资总额=" & sum
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -