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

📄 frm_xgmm.frm

📁 用VB语言写的班级管理系统举例,很具有参考价值!
💻 FRM
字号:
VERSION 5.00
Begin VB.Form FRM_XGMM 
   Caption         =   "修改密码"
   ClientHeight    =   5535
   ClientLeft      =   4515
   ClientTop       =   2415
   ClientWidth     =   7575
   Icon            =   "FRM_XGMM.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   ScaleHeight     =   5535
   ScaleWidth      =   7575
   Begin VB.Data Data_XGMM 
      Caption         =   "Data_XGMM"
      Connect         =   "Access 2000;"
      DatabaseName    =   ""
      DefaultCursorType=   0  '缺省游标
      DefaultType     =   2  '使用 ODBC
      Exclusive       =   0   'False
      Height          =   375
      Left            =   1800
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   ""
      Top             =   3840
      Width           =   2175
   End
   Begin VB.CommandButton cmdqx 
      Caption         =   "返回主窗体"
      Height          =   375
      Left            =   2520
      TabIndex        =   9
      Top             =   3120
      Width           =   1455
   End
   Begin VB.CommandButton cmdqd 
      Caption         =   "确定"
      Default         =   -1  'True
      Height          =   375
      Left            =   600
      TabIndex        =   8
      Top             =   3120
      Width           =   1335
   End
   Begin VB.TextBox txts 
      Height          =   270
      IMEMode         =   3  'DISABLE
      Index           =   3
      Left            =   1920
      PasswordChar    =   "*"
      TabIndex        =   7
      Text            =   "Text1"
      Top             =   2520
      Width           =   2055
   End
   Begin VB.TextBox txts 
      Height          =   270
      IMEMode         =   3  'DISABLE
      Index           =   2
      Left            =   1920
      PasswordChar    =   "*"
      TabIndex        =   6
      Text            =   "Text1"
      Top             =   2040
      Width           =   2055
   End
   Begin VB.TextBox txts 
      Height          =   270
      IMEMode         =   3  'DISABLE
      Index           =   1
      Left            =   1920
      PasswordChar    =   "*"
      TabIndex        =   5
      Text            =   "Text1"
      Top             =   1560
      Width           =   2055
   End
   Begin VB.TextBox txts 
      Height          =   270
      Index           =   0
      Left            =   1920
      TabIndex        =   4
      Text            =   "Text1"
      Top             =   1080
      Width           =   2055
   End
   Begin VB.Label Label5 
      Caption         =   "修改密码"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   21.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF00FF&
      Height          =   615
      Left            =   1440
      TabIndex        =   10
      Top             =   240
      Width           =   1935
   End
   Begin VB.Label Label4 
      Caption         =   "密码确认"
      Height          =   255
      Left            =   600
      TabIndex        =   3
      Top             =   2520
      Width           =   1095
   End
   Begin VB.Label Label3 
      Caption         =   "请输入新密码"
      Height          =   255
      Left            =   600
      TabIndex        =   2
      Top             =   2040
      Width           =   1095
   End
   Begin VB.Label Label2 
      Caption         =   "请输入原密码"
      Height          =   255
      Left            =   600
      TabIndex        =   1
      Top             =   1560
      Width           =   1095
   End
   Begin VB.Label Label1 
      Caption         =   "请输入用户名"
      Height          =   255
      Left            =   600
      TabIndex        =   0
      Top             =   1080
      Width           =   1215
   End
End
Attribute VB_Name = "FRM_XGMM"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdqd_Click()
    '将记录集定位到所输入的操作员
    Data_XGMM.RecordSource = "select * from MIMA where 操作员 = '" & txts(0).Text & "'"
    Data_XGMM.Refresh
    
    If Data_XGMM.Recordset.RecordCount = 0 Then
        '检验是否存在该操作员
        MsgBox "查无此操作员!", vbCritical
    ElseIf txts(1).Text = Data_XGMM.Recordset.Fields("密码") Then   '密码正确
            If txts(2).Text = txts(3).Text And txts(2).Text <> "" Then
                '密码正确且一致,则修改
                Data_XGMM.Recordset.Edit
                Data_XGMM.Recordset.Fields("密码") = txts(2)
                Data_XGMM.Recordset.Update
                MsgBox "密码修改成功!"
            ElseIf txts(2).Text <> txts(3).Text Then
                '密码不一致
                MsgBox "两次输入的密码不一致,请检验!", vbOKOnly + vbInformation, "修改密码"
            ElseIf MsgBox("新密码为空,是否使用空密码!", vbYesNo) = vbYes Then
                '新密码为空
                Data_XGMM.Recordset.Edit
                Data_XGMM.Recordset.Fields("密码") = txts(2)
                Data_XGMM.Recordset.Update
                MsgBox "密码修改成功!"
            Else
                Exit Sub
            End If
    Else
        '密码不正确
        MsgBox "密码不正确,请核实后再尝试!", vbCritical
    End If
End Sub

Private Sub cmdqx_Click()
    Unload Me
End Sub

Private Sub Form_Load()
    Dim j As Integer
    
    '连接数据库,打开“密码表”
    Data_XGMM.DatabaseName = App.Path + "\" & P_BJ & "\student.mdb"
    Data_XGMM.RecordSource = "MIMA"
    Data_XGMM.Visible = False
    
    '清空文本框
    For j = 0 To 3
       txts(j).Text = ""
    Next j
End Sub

Private Sub Form_Unload(Cancel As Integer)
    MAIN.Show
End Sub

⌨️ 快捷键说明

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