vb课程设计_职工工资管理系统代码
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Form1:
Dim errorCount As Integer
Private Sub Command1_Click()
If = "system" And = "1234" Then
Load Form2
MsgBox "登陆成功,欢迎您进入职工工资管理系统", vbInformation, "登陆成功"
Else
errorCount = errorCount + 1
If errorCount < 3 Then
MsgBox "用户名或密码错误(第" & errorCount & "次)!", vbOKOnly + vbExclamation, "登陆失败"
End If
If errorCount >= 3 Then
= False
= False
= False
MsgBox "三次输入用户名或密码错误,程序将自动退出!", vbOKOnly + vbExclamation, "登陆失败"
End
End If
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
errorCount = 0
End Sub
Private Sub Form_Unload(Cancel As Integer)
If MsgBox("是否要退出程序?", vbYesNo, "退出提示") = vbNo Then
Cancel = 1
End If
End Sub
Form2:
Dim filedir As String
Private Sub Command1_Click()
jlNum = 0
If Len(Trim) > 0 Then
filedir =
Open For Input As #1
Do While Not EOF(1)
Line Input #1, a
If Len(Trim(a)) > 0 Then
jlNum = jlNum + 1
End If
Loop
Close #1
ReDim Preserve ygList(jlNum) As YuanGong
jlNum = 0
Open For Input As #1
Do While Not EOF(1)
jlNum = jlNum + 1
Input #1, ygList(jlNum).ygnamg
Input #1, ygList(jlNum).jibengz
Input #1, ygList(jlNum).jingtie
Input #1, ygList(jlNum).gerensui
Input #1, ygList(jlNum).suidianfei
Loop
Close #1
= "姓名" & vbTab & "工资" & vbTab & "津贴" & vbTab & "所得税" & vbTab & "水电费" & vbCrLf
For i = 1 To jlNum
= & ygList(i).ygnamg & vbTab & ygList(i).jibengz & vbTab & ygList(i).jingtie & vbTab & ygList(i).gerensui & vbTab & ygList(i).suidianfei & vbCrLf
Next
= True
= False
= False
= True
= True
End Sub
Private Sub Command2_Click()
For i = 1 To jlNum
ygList(i).shifagongzi = (CSng(ygList(i).jibengz) + CSng(ygList(i).jingtie) - ygList(i).gerensui - CSng(ygList(i).suidianfei))
Next
loadData
= True
= True
End Sub
Private Sub Command3_Click()
Dim zuiDa As Integer
Dim linShi As YuanGong
zuiDa = 1
Dim shifoujiaohuan As Boolean
For y = 1 To UBound(ygList)
shifoujiaohuan = False
zuiDa = y
For x = y To UBound(ygList)
If ygList(x).shifagongzi < ygList(zuiDa).shifagongzi Then
zuiDa = x
shifoujiaohuan = True
End If
Next
If shifoujiaohuan Then
= ygList(y).ygnamg
ygList(y).ygnamg = ygList(zuiDa).ygnamg
ygList(zuiDa).ygnamg =
= ygList(y).jibengz
ygList(y).jibengz = ygList(zuiDa).jibengz
ygList(zuiDa).jibengz =
= ygList(y).jingtie
ygList(y).jingtie = ygList(zuiDa).jingtie
ygList(zuiDa).jingtie =
= ygList(y).gerensui
ygList(y).gerensui = ygList(zuiDa).gerensui
ygList(zuiDa).gerensui =
= ygList(y).suidianfei
ygList(y).suidianfei = ygList(zuiDa).suidianfei
ygList(zuiDa).suidianfei =