代码如下:
Option Explicit
Const MxUser = 100
Public EmploID As Integer
Public CurUser As String
Public CurId As String
Public CurPsw As String
Dim user(MxUser), pws(MxUser), state(MxUser), Emplo(MxUser) As String
Private Sub cmdOK_Click()
If txtPassword = pws(Combo1.ListIndex) Then
CurId = Combo1.ListIndex
EmploID = Emplo(CurId)
CurUser = user(CurId)
CurPsw = pws(CurId)
Me.Hide
FrmMain.Show
Else
MsgBox "密码错误请重新输入密码!", , "Login"
txtPassword.SetFocus
SendKeys "{Home}+{End}"
End If
End Sub
Private Sub Command2_Click()
Unload Me
End
End Sub
Private Sub Form_Load()
Dim i As Integer
If App.PrevInstance Then
MsgBox ("程序已经运行,不能再次装载。"), vbExclamation
Unload Me
End If
i = 0
Open App.Path + "\user.ini" For Input As #1
Do While Not EOF(1)
Input #1, user(i), pws(i), state(i), Emplo(i)
If state(i) = "A" Then
Combo1.AddItem user(i)
End If
i = i + 1
Loop
Close #1
Combo1.ListIndex = 1
End Sub
进入系统主界面:
图6.2系统主界面
代码如下:
Private Sub bumen_Click(Index As Integer)
DataReport2.Show
End Sub
Private Sub gongzi_Click(Index As Integer)
DataReport1.Show
End Sub
Private Sub jiaoshi_Click(Index As Integer)
DataReport4.Show
End Sub
Private Sub MAbout_Click()
frmAbout.Show
End Sub
Private Sub Mhelp_Click()
FrmHelp.Show
End Sub
Private Sub Moption_Click(Index As Integer)
If Index = 0 Then
FrmPsw.Show
Else
End
End If
End Sub
Private Sub Mtab_Click(Index As Integer)
Select Case Index
751com.cn
'FrmMain.Hide
frmzhiwu.Show
End Select
End Sub
Private Sub zhiwu_Click(Index As Integer)
DataReport3.Show
End Sub
选择密码修改:
图6.3密码修改界面
代码如下:
Option Explicit
Const MxUser = 100
Dim user(MxUser), pws(MxUser), state(MxUser), Emplo(MxUser) As String
Private Sub cmdCancel_Click()
Me.Hide
End Sub
Private Sub cmdOK_Click()
Dim fil, i, Usercount As Integer
If TxtNew1.Text <> TxtNew2.Text Then
MsgBox "two times no yizhi"
TxtNew1.SetFocus
TxtNew2.Text = ""
SendKeys "{Home}+{End}"
Exit Sub
ElseIf Txtold.Text <> FrmLogin.CurPsw Then
MsgBox "old password wrong"
Txtold.SetFocus
TxtNew1.Text = ""
TxtNew2.Text = ""
SendKeys "{Home}+{End}"
Exit Sub
Else
fil = FreeFile()
Open App.Path + "\user.ini" For Input As #fil
i = 0
Do While Not EOF(fil)
Input #fil, user(i), pws(i)
Input #fil, state(i), Emplo(i)
i = i + 1
Loop
Usercount = i
Close #fil
pws(FrmLogin.CurId) = TxtNew1.Text
FrmLogin.CurPsw = TxtNew1.Text
fil = FreeFile()
Open App.Path + "\user.ini" For Output As #fil
For i = 0 To Usercount - 1
Print #fil, user(i); ","; pws(i); ","; state(i); ","; Emplo(i)
Next i
Close #fil
Txtold.Text = ""
TxtNew1.Text = ""
TxtNew2.Text = ""
Me.Hide
End If
End Sub
Private Sub Form_LostFocus()
FrmPsw.SetFocus
End Sub
Private Sub Form_Unload(Cancel As Integer)
Unload Me
End Sub
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] 下一页