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

📄 changcode.frm

📁 班里一位同学做的学生管理系统的课程实习
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmchangecode 
   BackColor       =   &H8000000E&
   Caption         =   "修改密码"
   ClientHeight    =   3090
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   4680
   FillColor       =   &H0000FF00&
   ForeColor       =   &H80000018&
   LinkTopic       =   "Form2"
   ScaleHeight     =   3090
   ScaleWidth      =   4680
   StartUpPosition =   2  '屏幕中心
   Begin VB.Data Data1 
      Caption         =   "data1"
      Connect         =   "Access"
      DatabaseName    =   ""
      DefaultCursorType=   0  '缺省游标
      DefaultType     =   2  '使用 ODBC
      Exclusive       =   0   'False
      Height          =   375
      Left            =   960
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   ""
      Top             =   2400
      Visible         =   0   'False
      Width           =   1935
   End
   Begin VB.CommandButton Command2 
      Caption         =   "取消"
      Height          =   375
      Left            =   2280
      TabIndex        =   7
      Top             =   1920
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "修改"
      Height          =   375
      Left            =   600
      TabIndex        =   6
      Top             =   1920
      Width           =   975
   End
   Begin VB.TextBox Text3 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      IMEMode         =   3  'DISABLE
      Left            =   1800
      PasswordChar    =   "*"
      TabIndex        =   5
      Top             =   1320
      Width           =   1815
   End
   Begin VB.TextBox Text2 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      IMEMode         =   3  'DISABLE
      Left            =   1800
      PasswordChar    =   "*"
      TabIndex        =   4
      Top             =   720
      Width           =   1815
   End
   Begin VB.TextBox Text1 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   1800
      TabIndex        =   3
      Top             =   120
      Width           =   1815
   End
   Begin VB.Label Label3 
      BackColor       =   &H80000013&
      Caption         =   "请再次输入密码"
      Height          =   375
      Left            =   240
      TabIndex        =   2
      Top             =   1440
      Width           =   1455
   End
   Begin VB.Label Label2 
      BackColor       =   &H80000013&
      Caption         =   "请输入新密码"
      Height          =   375
      Left            =   240
      TabIndex        =   1
      Top             =   840
      Width           =   1335
   End
   Begin VB.Label Label1 
      BackColor       =   &H80000013&
      Caption         =   "请输入您的用户名"
      Height          =   375
      Left            =   240
      TabIndex        =   0
      Top             =   240
      Width           =   1455
   End
End
Attribute VB_Name = "frmchangecode"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
 If flag = 2 Then
    MsgBox "您没有权限进行添加用户!退出操作!!"
    Text1.Text = ""
    Text2.Text = ""
    Text3.Text = ""
    Text1.SetFocus
   Unload frmcanceluser
   Exit Sub
End If

 
'检查用户名和密码不为空,以及两次输入的密码是否一致
If Text1.Text = "" Then
 MsgBox "用户名不能为空,请重输!!!"
Text1.SetFocus
 Exit Sub
End If
If Text2.Text = "" Then
  MsgBox "密码不能为空,请重新输入!!!"
 Text2.SetFocus
  Exit Sub
End If
If Text2.Text <> Text3.Text Then
 MsgBox "两次输入的密码不一致,请重输!!"
 Text2.Text = ""
 Text3.Text = ""
Text3.SetFocus
 Exit Sub
End If

Data1.Connect = "Access"
Data1.DatabaseName = "" & App.Path & "\db1.mdb"
Data1.RecordSource = "select *from user"
Data1.Refresh
 '查看要修改的用户的记录
Data1.Recordset.MoveFirst
While Data1.Recordset.Fields("User_Name") <> Text1.Text
     Data1.Recordset.MoveNext
     If Data1.Recordset.EOF Then
         MsgBox "您要修改的用户不存在!!!"
         Text1.Text = ""
         Text2.Text = ""
         Text3.Text = ""
         Text1.SetFocus
         Exit Sub
     End If
Wend

Data1.Recordset.Edit
Data1.Recordset.Fields("User_Password").Value = Text2.Text
Data1.Recordset.Update

MsgBox "修改密码成功!!"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text1.Text = ""

End Sub

Private Sub Command2_Click()
Unload frmchangecode
End Sub


Private Sub Form_Load()
If flag = 2 Then
 Label1.ToolTipText = "您无权修改!"
 Text1.ToolTipText = "您无权修改!"
 End If
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
  Text2.SetFocus
End If
End Sub



Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
  Text3.SetFocus
End If
End Sub



Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Call Command1_Click
End If
End Sub

⌨️ 快捷键说明

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