VB+SQL Server2000中小型医院药品管理系统 第9页
图5.12药品管理系统的程序流程图
第六章 编码实现与测试用例设计
6.1登录界面
图6.1 系统登录界面图
Dim txt As String, n As Integer, k As Integer
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Form_Load()
n = 0
txt = "一切为了客户方便,一切为了医院发展!"
k = Len(txt)
Label2.ForeColor = &HFF00FF
End Sub
Private Sub Label1_Click()
frm.Show
End Sub
Private Sub Label3_Click()
frm.Show
End Sub
Private Sub Timer1_Timer()
If Label3.ForeColor = &HFFFF& Then
Label3.ForeColor = &HFF0000
ElseIf Label3.ForeColor = &HFF0000 Then
Label3.ForeColor = &HFF00FF
Else
Label3.ForeColor = &HFFFF&
End If
n = n + 1
If n <= k Then
Label2.Caption = Left(txt, n)
Else
n = 0
Label2.Caption = ""
End If
End Sub
6.2密码窗口界面
图6.2 密码窗口界面图
Option Explicit
Dim cnt As Integer '记录确定次数
Private Sub Command1_Click()
Dim sql As String
Dim rs_login As New ADODB.Recordset
Dim conn As New ADODB.Connection
conn.Open "provider=Microsoft.Jet.OLEDB.4.0; data source=" & App.Path & "\kaoqin.mdb"
If Trim(Text1.Text) = "" Then '判断输入的用户名是否为空
MsgBox "用户名不能为空,请重新输入!"
Text1.SetFocus
Else
sql = "select * from users where 用户名='" & Trim(Text1.Text) & "'"
rs_login.Open sql, conn, adOpenKeyset, adLockPessimistic
If rs_login.EOF = True Then '检验是否有此用户
MsgBox "没有这个用户,请重输入!", vbOKOnly + vbExclamation, ""
Text1.Text = ""
Text1.SetFocus
Else '检验密码是否正确
If Trim(rs_login.Fields(1)) = Trim(Text2.Text) Then
Unload Me
zjm.Show
Else
MsgBox "密码不正确,请重输入!", vbOKOnly + vbExclamation, "" 'MsgBox "您输入的原密码不正确,请重试", , "出错信息提示"
Text2.SetFocus
Text2.Text = ""
End If
End If
End If
cnt = cnt + 1
If cnt = 3 Then
MsgBox "对不起,你是非法用户!"
Unload Me
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
cnt = 0
End Sub
Private Sub Label4_Click()
End Sub
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >>