www.pudn.com > 西南医院.rar > FrmLogin.frm


VERSION 5.00 
Begin VB.Form FrmLogin  
   Caption         =   "登陆窗体" 
   ClientHeight    =   2880 
   ClientLeft      =   60 
   ClientTop       =   345 
   ClientWidth     =   4680 
   LinkTopic       =   "Form1" 
   ScaleHeight     =   2880 
   ScaleWidth      =   4680 
   StartUpPosition =   2  '屏幕中心 
   Begin VB.Data Data1  
      Caption         =   "Data1" 
      Connect         =   "Access 2000;" 
      DatabaseName    =   "" 
      DefaultCursorType=   0  '缺省游标 
      DefaultType     =   2  '使用 ODBC 
      Exclusive       =   0   'False 
      Height          =   345 
      Left            =   2520 
      Options         =   0 
      ReadOnly        =   0   'False 
      RecordsetType   =   1  'Dynaset 
      RecordSource    =   "" 
      Top             =   1680 
      Visible         =   0   'False 
      Width           =   1815 
   End 
   Begin VB.CommandButton Command2  
      Caption         =   "关 闭" 
      BeginProperty Font  
         Name            =   "MS Sans Serif" 
         Size            =   8.25 
         Charset         =   0 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   495 
      Left            =   2520 
      TabIndex        =   5 
      Top             =   2280 
      Width           =   1215 
   End 
   Begin VB.CommandButton Command1  
      Caption         =   "登 陆" 
      BeginProperty Font  
         Name            =   "MS Sans Serif" 
         Size            =   8.25 
         Charset         =   0 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   495 
      Left            =   720 
      TabIndex        =   4 
      Top             =   2280 
      Width           =   1215 
   End 
   Begin VB.TextBox TxtPwd  
      Height          =   495 
      IMEMode         =   3  'DISABLE 
      Left            =   1920 
      PasswordChar    =   "*" 
      TabIndex        =   3 
      Top             =   1440 
      Width           =   1935 
   End 
   Begin VB.TextBox TxtUser  
      Height          =   495 
      Left            =   1920 
      TabIndex        =   2 
      Top             =   720 
      Width           =   1935 
   End 
   Begin VB.Label Label3  
      Alignment       =   2  'Center 
      Caption         =   "西南医院中医科病人资料管理系统" 
      BeginProperty Font  
         Name            =   "新宋体" 
         Size            =   12 
         Charset         =   0 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   495 
      Left            =   0 
      TabIndex        =   6 
      Top             =   150 
      Width           =   4800 
   End 
   Begin VB.Label Label2  
      Caption         =   "密 码" 
      BeginProperty Font  
         Name            =   "MS Sans Serif" 
         Size            =   12 
         Charset         =   0 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   255 
      Left            =   720 
      TabIndex        =   1 
      Top             =   1560 
      Width           =   735 
   End 
   Begin VB.Label Label1  
      Caption         =   "用户名" 
      BeginProperty Font  
         Name            =   "MS Sans Serif" 
         Size            =   12 
         Charset         =   0 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   255 
      Left            =   720 
      TabIndex        =   0 
      Top             =   720 
      Width           =   735 
   End 
End 
Attribute VB_Name = "FrmLogin" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
Private Sub Command1_Click() 
Static i As Integer '检测输入错误次数 
If TxtUser.Text = "" Then 
   MsgBox "用户名不能为空", vbOKOnly + vbCritical, "系统提示" 
   TxtUser.SetFocus 
   Exit Sub 
End If 
If TxtPwd.Text = "" Then 
   MsgBox "密码不能为空", vbOKOnly + vbCritical, "系统提示" 
   TxtPwd.SetFocus 
   Exit Sub 
End If 
'*********************** 
'On Error Resume Next 
Data1.Recordset.MoveFirst 
Do While Not Data1.Recordset.EOF 
    If Data1.Recordset.Fields("id") = TxtUser.Text Then '检测用户名 
       If Data1.Recordset.Fields("pwd") = TxtPwd.Text Then '检测密码 
          FrmMdi.StatusBar1.Panels(1).Text = "当前操作员:" & TxtUser.Text 
          FrmMdi.Show 
          Unload Me 
          Exit Sub 
          Else 
            i = i + 1 
            If i >= 3 Then '检测错误次数 
                MsgBox "你已经三次输入错误,谢谢使用!", vbOKOnly + vbQuestion, "系统提示" 
                Unload Me 
                Exit Sub 
            End If '密码错误处理 
        MsgBox "密码错误", vbOKOnly + vbCritical, "系统提示" 
        TxtPwd.Text = "" 
        TxtPwd.SetFocus 
        Exit Sub 
       End If 
    End If 
    Data1.Recordset.MoveNext '数据移动到下一条 
Loop 
    i = i + 1 
    If i >= 3 Then '检测错误次数 
       MsgBox "你已经三次输入错误,谢谢使用!", vbOKOnly + vbQuestion, "系统提示" 
       Unload Me 
       Exit Sub 
    End If '用户名错误处理 
    MsgBox "用户名错误", vbOKOnly + vbCritical, "系统提示" 
    TxtUser.Text = "" 
    TxtUser.SetFocus 
    Exit Sub 
End Sub 
 
Private Sub Command2_Click() 
Unload Me 
End Sub 
 
Private Sub Form_Load() 
Data1.DatabaseName = App.Path & "\message.mdb" 
Data1.RecordSource = "admin" 
End Sub 
 
Private Sub TxtPwd_KeyPress(KeyAscii As Integer) 
If KeyAscii = 13 Then 
   Command1.SetFocus 
End If 
End Sub 
 
Private Sub TxtUser_KeyPress(KeyAscii As Integer) 
If KeyAscii = 13 Then 
   TxtPwd.SetFocus 
End If 
End Sub