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

📄 frmpassword.frm

📁 人事管理系统的一个比较不错的VB软件 有管理系统的功能
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmPassword 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "修改密码"
   ClientHeight    =   3195
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4125
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   3195
   ScaleWidth      =   4125
   Begin VB.CommandButton cmdSave 
      Caption         =   "确定"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   1200
      TabIndex        =   6
      Top             =   2160
      Width           =   1695
   End
   Begin VB.TextBox txtItem 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   375
      IMEMode         =   3  'DISABLE
      Index           =   2
      Left            =   1600
      MaxLength       =   15
      PasswordChar    =   "*"
      TabIndex        =   5
      Top             =   1440
      Width           =   2000
   End
   Begin VB.TextBox txtItem 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   375
      IMEMode         =   3  'DISABLE
      Index           =   1
      Left            =   1600
      MaxLength       =   15
      PasswordChar    =   "*"
      TabIndex        =   4
      Top             =   840
      Width           =   2000
   End
   Begin VB.TextBox txtItem 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   375
      IMEMode         =   3  'DISABLE
      Index           =   0
      Left            =   1600
      MaxLength       =   15
      PasswordChar    =   "*"
      TabIndex        =   3
      Top             =   240
      Width           =   2000
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      Caption         =   "新密码确认"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Left            =   290
      TabIndex        =   2
      Top             =   1530
      Width           =   1125
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "新密码"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Left            =   720
      TabIndex        =   1
      Top             =   930
      Width           =   675
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "旧密码"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Left            =   720
      TabIndex        =   0
      Top             =   330
      Width           =   675
   End
End
Attribute VB_Name = "frmPassword"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public mrc As ADODB.Recordset
Dim txtSql As String

Private Sub cmdSave_Click()
   Dim i As Integer
   
   If Not check_password Then
      Exit Sub
   End If
   
   txtSql = "select * from passwd where Id ='" & PublicUserId & "'"
   
   Set mrc = Nothing
   
   Set mrc = ExecuteSQL(txtSql)
   
   If Not mrc.EOF Then '修改
      If Trim(mrc.Fields(1).Value) = Trim(txtItem(0).Text) Then
         mrc.Fields(1) = txtItem(1).Text
         mrc.Update
      Else
         MsgBox "旧密码不正确", vbCritical + vbOKOnly, "错误提示: "
         txtItem(0).SetFocus
         Exit Sub
      End If
   Else '新增密码
      txtSql = "select * from passwd"
      Set mrc = Nothing
      Set mrc = ExecuteSQL(txtSql)
      mrc.AddNew
      mrc.Fields(0) = PublicUserId
      mrc.Fields(1) = txtItem(1).Text
      mrc.Update
   End If
   
   MsgBox "密码修改成功!!"
   
   For i = 0 To 2
     txtItem(i).Text = ""
   Next i
   Me.Hide
   
End Sub

Private Sub Form_Load()
   Me.Left = (Screen.Width - Me.Width) / 2
   Me.Top = (Screen.Height - Me.Height) / 2
End Sub

Private Sub txtItem_KeyPress(Index As Integer, KeyAscii As Integer)
   If KeyAscii = 13 Then
      If Index < 2 Then
         txtItem(Index + 1).SetFocus
      Else
         cmdSave.SetFocus
      End If
   End If
End Sub

Private Function check_password() As Boolean
   check_password = True
   If txtItem(1).Text <> txtItem(2).Text Then
      MsgBox "新密码确认不正确", vbCritical + vbOKOnly, "错误提示: "
      txtItem(1).SetFocus
      check_password = False
      
   End If
End Function


   

⌨️ 快捷键说明

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