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

📄 frmchangeuser.frm

📁 这是一个用VB编写的用于外贸行业的供应商信息管理系统。
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmChangeUser 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "changeuser"
   ClientHeight    =   3105
   ClientLeft      =   2760
   ClientTop       =   3750
   ClientWidth     =   5640
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3105
   ScaleWidth      =   5640
   ShowInTaskbar   =   0   'False
   Begin VB.TextBox txtOldPassword 
      Height          =   375
      IMEMode         =   3  'DISABLE
      Left            =   2280
      PasswordChar    =   "*"
      TabIndex        =   3
      Top             =   840
      Width           =   2055
   End
   Begin VB.TextBox txtNewPassword 
      Height          =   375
      IMEMode         =   3  'DISABLE
      Left            =   2280
      PasswordChar    =   "*"
      TabIndex        =   5
      Top             =   1440
      Width           =   2055
   End
   Begin VB.TextBox txtUsername 
      Height          =   375
      Left            =   2280
      TabIndex        =   1
      Top             =   240
      Width           =   2055
   End
   Begin VB.CommandButton CancelButton 
      Caption         =   "&cancel"
      Height          =   375
      Left            =   3240
      TabIndex        =   7
      Top             =   2400
      Width           =   1215
   End
   Begin VB.CommandButton OKButton 
      Caption         =   "&ok"
      Default         =   -1  'True
      Height          =   375
      Left            =   1320
      TabIndex        =   6
      Top             =   2400
      Width           =   1215
   End
   Begin VB.Label Label3 
      Caption         =   "&newpassword:"
      Height          =   495
      Left            =   1080
      TabIndex        =   4
      Top             =   1560
      Width           =   1215
   End
   Begin VB.Label Label2 
      Caption         =   "&oldpassword:"
      Height          =   615
      Left            =   1080
      TabIndex        =   2
      Top             =   960
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "&username:"
      Height          =   375
      Left            =   1320
      TabIndex        =   0
      Top             =   360
      Width           =   1095
   End
End
Attribute VB_Name = "frmChangeUser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Option Explicit
Public cn As New ADODB.Connection
Public rs As New ADODB.Recordset


Private Sub CancelButton_Click()
    Unload Me
End Sub

Private Sub Form_Activate()
    txtUsername.SetFocus
End Sub

Private Sub Form_Load()
    Set cn = New ADODB.Connection
    cn.Open strCn
End Sub

Private Sub OKButton_Click()
    Set rs = New ADODB.Recordset
    rs.Open "select * from users where username='" & txtUsername.Text & "' and password='" & txtOldPassword.Text & "'", cn, adOpenDynamic
    If rs.EOF <> True Then  '用户名密码正确,可以修改
        rs.Close
        rs.Open "users", cn, adOpenKeyset, adLockOptimistic, adCmdTable
        rs.Find "username='" & txtUsername.Text & "'"
        rs.Fields("password") = txtNewPassword.Text
        rs.Update
        MsgBox "password change ok!", vbInformation, "change user password"
        CancelButton.SetFocus
    Else
        MsgBox "the oldpassword is error, can not be changed!", vbCritical, "change user password error"
        rs.Close
        txtOldPassword.SetFocus
    End If
End Sub

Private Sub txtOldPassword_gotfocus()
    txtOldPassword.SelStart = 0
    txtOldPassword.SelLength = Len(txtOldPassword.Text)
End Sub

Private Sub txtOldPassword_LostFocus()
    If Len(txtOldPassword.Text) > 30 Or Len(txtOldPassword.Text) < 6 Then
        MsgBox "the length of oldpassword need between 6 and 30.", vbCritical, "length error"
    End If
End Sub

Private Sub txtUsername_gotfocus()
    txtUsername.SelStart = 0
    txtUsername.SelLength = Len(txtUsername.Text)
End Sub

Private Sub txtUsername_LostFocus()
    If Len(txtUsername.Text) > 30 Then
        MsgBox "the length of username need less 30.", vbCritical, "over length error"
    End If
End Sub

Private Sub txtNewPassword_gotfocus()
    txtNewPassword.SelStart = 0
    txtNewPassword.SelLength = Len(txtNewPassword.Text)
End Sub
Private Sub txtNewPassword_LostFocus()
    If Len(txtNewPassword.Text) > 30 Or Len(txtNewPassword.Text) < 6 Then
        MsgBox "the length of newpassword need between 6 and 30.", vbCritical, "length error"
    End If
End Sub

⌨️ 快捷键说明

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