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

📄 form4.frm

📁 英语字典
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmAddUser 
   BackColor       =   &H00FFC0C0&
   Caption         =   "管理用户"
   ClientHeight    =   3150
   ClientLeft      =   60
   ClientTop       =   390
   ClientWidth     =   4680
   LinkTopic       =   "Form4"
   ScaleHeight     =   11550
   ScaleWidth      =   19080
   StartUpPosition =   3  '窗口缺省
   WindowState     =   2  'Maximized
   Begin VB.PictureBox Picture1 
      Height          =   2775
      Left            =   3600
      Picture         =   "Form4.frx":0000
      ScaleHeight     =   2715
      ScaleWidth      =   11835
      TabIndex        =   10
      Top             =   360
      Width           =   11895
   End
   Begin VB.CommandButton cmdReturn 
      Caption         =   "返回"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Left            =   12120
      TabIndex        =   7
      Top             =   9960
      Width           =   2175
   End
   Begin VB.CommandButton cmdCancel 
      Caption         =   "取消"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Left            =   9240
      TabIndex        =   6
      Top             =   9960
      Width           =   2295
   End
   Begin VB.CommandButton cmdAddUser 
      Caption         =   "添加"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Left            =   6240
      TabIndex        =   5
      Top             =   9960
      Width           =   2295
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H00FFC0C0&
      Caption         =   "添加用户"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   5655
      Left            =   4800
      TabIndex        =   0
      Top             =   3600
      Width           =   9375
      Begin VB.TextBox txtType 
         Height          =   735
         Left            =   4080
         TabIndex        =   8
         Top             =   3720
         Width           =   3615
      End
      Begin VB.TextBox txtPassword 
         Height          =   735
         Left            =   4080
         TabIndex        =   4
         Top             =   2280
         Width           =   3615
      End
      Begin VB.TextBox txtUserName 
         Height          =   735
         Left            =   4080
         TabIndex        =   2
         Top             =   1200
         Width           =   3615
      End
      Begin VB.Label Label3 
         BackColor       =   &H00FFC0C0&
         Caption         =   "用户类型"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   14.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   2040
         TabIndex        =   9
         Top             =   3960
         Width           =   1335
      End
      Begin VB.Label Label2 
         BackColor       =   &H00FFC0C0&
         Caption         =   "用户密码"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   14.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   2040
         TabIndex        =   3
         Top             =   2520
         Width           =   1335
      End
      Begin VB.Label Label1 
         BackColor       =   &H00FFC0C0&
         Caption         =   "用户名"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   14.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   2040
         TabIndex        =   1
         Top             =   1320
         Width           =   1215
      End
   End
End
Attribute VB_Name = "frmAddUser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdCancel_Click()
txtUserName.Text = ""
txtPassword.Text = ""
txtType.Text = ""
Rs.Updata
cmdAdd.Enabled = True
cmdCanael.Enabled = False
cmdReturn.Enabled = True
End Sub


Private Sub cmdAdd_Click()
If txtUserName.Text = "" Then   '判断用户名输入是否为空
MsgBox "用户名不能为空", vbOKOnly + vbExclamation, "警告"
Exit Sub
txtUserName.SetFocus
Else
    While (Rs.EOF = False)    '判断是否有重复记录
    If Rs!用户名 = txtUserName.Text And Rs!用户类型 = txtType.Text Then
     MsgBox "该用户已存在,请重新输入", vbOKOnly + vbExclamation, "警告"
     txtUserName.Text = ""
     txtPassword.Text = ""
     txtType.Text = ""
     txtUserName.SetFocus
     Exit Sub
    Else
    Rs.MoveNext
    End If
    Wend
    Rs.AddNew
    Rs!用户名 = txtUserName.Text
    Rs!密码 = txtPassword.Text
    Rs!用户类型 = txtType.Text
    Rs.Updata
    MsgBox "新用户:" & txtUserName.Text & "添加成功", vbInformation, "提示"
    Rs.Close
    Set Rs = Nothing
End If
txtUserName.Text = ""
txtPassword.Text = ""
txtType.Text = ""
End Sub


Private Sub cmdReturn_Click()
Unload Me
frmAdmainUser.Show
End Sub


Private Sub Form_Load()
Call Module1.connection
Dim textsql As String
Dim MsgText As String
Dim Rs As New ADODB.Recordset
strsql = "select * form 用户信息表"
'Rs.Open straql
Set Rs = ExecuteSQL(txtsql, MsgText)
txtUserName.SetFocus
End Sub

Private Sub Form_Unload(Cancel As Integer)
Rs.Close
End Sub

⌨️ 快捷键说明

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