⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmedit_user.frm

📁 用VB开发的一个学生管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Frmedit_user 
   AutoRedraw      =   -1  'True
   Caption         =   "修改密码"
   ClientHeight    =   3825
   ClientLeft      =   60
   ClientTop       =   420
   ClientWidth     =   5955
   LinkTopic       =   "Form1"
   ScaleHeight     =   3825
   ScaleWidth      =   5955
   StartUpPosition =   2  '屏幕中心
   Begin VB.Data Data1 
      Caption         =   "Data1"
      Connect         =   "Access"
      DatabaseName    =   ""
      DefaultCursorType=   0  '缺省游标
      DefaultType     =   2  '使用 ODBC
      Exclusive       =   0   'False
      Height          =   375
      Left            =   480
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   ""
      Top             =   2520
      Visible         =   0   'False
      Width           =   4335
   End
   Begin VB.CommandButton cmd_cancel 
      Caption         =   "取消"
      Height          =   495
      Left            =   2760
      TabIndex        =   9
      Top             =   2880
      Width           =   1215
   End
   Begin VB.CommandButton cmd_OK 
      Caption         =   "确认"
      Height          =   495
      Left            =   960
      TabIndex        =   8
      Top             =   2880
      Width           =   1215
   End
   Begin VB.TextBox txtPwd2 
      Height          =   495
      IMEMode         =   3  'DISABLE
      Left            =   2280
      PasswordChar    =   "*"
      TabIndex        =   7
      Top             =   2040
      Width           =   1695
   End
   Begin VB.TextBox txtPwd1 
      Height          =   495
      IMEMode         =   3  'DISABLE
      Left            =   2280
      PasswordChar    =   "*"
      TabIndex        =   6
      Top             =   1440
      Width           =   1695
   End
   Begin VB.TextBox txtPwd0 
      Height          =   495
      IMEMode         =   3  'DISABLE
      Left            =   2280
      PasswordChar    =   "*"
      TabIndex        =   5
      Top             =   720
      Width           =   1695
   End
   Begin VB.TextBox txtUser 
      Height          =   495
      Left            =   2280
      TabIndex        =   4
      Top             =   120
      Width           =   1695
   End
   Begin VB.Label Label4 
      Caption         =   "请确认新密码:"
      Height          =   375
      Left            =   600
      TabIndex        =   3
      Top             =   2160
      Width           =   1335
   End
   Begin VB.Label Label3 
      Caption         =   "请输入新密码:"
      Height          =   375
      Left            =   600
      TabIndex        =   2
      Top             =   1560
      Width           =   1335
   End
   Begin VB.Label Label2 
      Caption         =   "请输入旧密码:"
      Height          =   375
      Left            =   600
      TabIndex        =   1
      Top             =   960
      Width           =   1455
   End
   Begin VB.Label Label1 
      Caption         =   "用户名:"
      Height          =   375
      Left            =   840
      TabIndex        =   0
      Top             =   240
      Width           =   975
   End
End
Attribute VB_Name = "Frmedit_user"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmd_cancel_Click()
Unload Me
End Sub

Private Sub cmd_OK_Click()
Data1.Recordset.MoveFirst
Data1.Refresh

If txtUser = "" Then
MsgBox "请输入用户名", vbExclamation, "警告"
txtUser.SetFocus
Else
If txtPwd0 = "" Then
MsgBox "请输入旧密码", vbExclamation, "警告"
txtPwd0.SetFocus
Else
If txtPwd1 = "" Then
MsgBox "请输入新密码", vbExclamation, "警告"
txtPwd1.SetFocus
Else
If txtPwd2 = "" Then
MsgBox "请确认新密码", vbExclamation, "警告"
txtPwd2.SetFocus
Else

Do While Not Data1.Recordset.EOF
If Trim(Data1.Recordset.Fields("UserName")) = Trim(txtUser.Text) Then
    If Trim(Data1.Recordset.Fields("UserPwd")) = Trim(txtPwd0.Text) Then
        If Trim(txtPwd1.Text) = Trim(txtPwd2.Text) Then
            Data1.Recordset.Delete
            Data1.Recordset.AddNew
            Data1.Recordset("UserName") = Trim(txtUser.Text)
            Data1.Recordset("UserPwd") = Trim(txtPwd1.Text)
            Data1.Recordset.Update
            MsgBox "密码修改成功", 48, "提示"
            Unload Me
            FrmMain.Show
        Else
            MsgBox "确认新密码有误", 0 + 48, "警告!"
            txtPwd2 = ""
            txtPwd2.SetFocus
            Exit Sub
        End If

    Else
         MsgBox "旧密码有错误", vbExclamation, "警告"
         txtPwd0 = ""
         txtPwd0.SetFocus
         Exit Sub
    End If

  
  Else
        Data1.Recordset.MoveNext
  End If
  Loop
   MsgBox "用户名有错误", vbExclamation, "警告"
   txtUser = ""
   txtUser.SetFocus
   Exit Sub
End If
End If
End If
End If

End Sub



Private Sub Form_Load()

Dim dbname As String
Dim sql As String
dbname = App.Path
If Right$(dbname, 1) <> "\" Then dbname = dbname & "\"
dbname = dbname & "student_MG.mdb"
Data1.DatabaseName = dbname
sql = "select * from " & "Users"
Data1.RecordSource = sql
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -