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

📄 form18.frm

📁 VB编写的企业管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form18 
   BackColor       =   &H000080FF&
   Caption         =   "添加用户"
   ClientHeight    =   7545
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   8115
   Icon            =   "Form18.frx":0000
   LinkTopic       =   "Form18"
   ScaleHeight     =   7545
   ScaleWidth      =   8115
   StartUpPosition =   2  '屏幕中心
   Begin VB.ComboBox Combo1 
      Height          =   300
      ItemData        =   "Form18.frx":08CA
      Left            =   3240
      List            =   "Form18.frx":08D4
      TabIndex        =   8
      Text            =   "Combo1"
      Top             =   5280
      Width           =   2655
   End
   Begin VB.TextBox UserName 
      Height          =   615
      Left            =   3120
      TabIndex        =   7
      Top             =   1560
      Width           =   3615
   End
   Begin VB.TextBox PassWord 
      Height          =   615
      IMEMode         =   3  'DISABLE
      Left            =   3120
      PasswordChar    =   "*"
      TabIndex        =   6
      Top             =   2760
      Width           =   3615
   End
   Begin VB.TextBox confirmPWD 
      Height          =   615
      IMEMode         =   3  'DISABLE
      Left            =   3120
      PasswordChar    =   "*"
      TabIndex        =   5
      Top             =   4200
      Width           =   3615
   End
   Begin VB.CommandButton Command2 
      Caption         =   "退出"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   4680
      TabIndex        =   4
      Top             =   6840
      Width           =   1455
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确定"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   1080
      TabIndex        =   3
      Top             =   6840
      Width           =   1335
   End
   Begin VB.Label Label4 
      BackColor       =   &H000080FF&
      BackStyle       =   0  'Transparent
      Caption         =   "用户权限:"
      BeginProperty Font 
         Name            =   "隶书"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   600
      TabIndex        =   9
      Top             =   5400
      Width           =   1695
   End
   Begin VB.Image Image1 
      Height          =   1350
      Left            =   2760
      Picture         =   "Form18.frx":08E4
      Top             =   0
      Width           =   1350
   End
   Begin VB.Label Label3 
      Appearance      =   0  'Flat
      BackColor       =   &H000080FF&
      BackStyle       =   0  'Transparent
      Caption         =   "确认密码:"
      BeginProperty Font 
         Name            =   "隶书"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   495
      Left            =   480
      TabIndex        =   2
      Top             =   4320
      Width           =   2295
   End
   Begin VB.Label Label2 
      Appearance      =   0  'Flat
      BackColor       =   &H000080FF&
      BackStyle       =   0  'Transparent
      Caption         =   "用户密码:"
      BeginProperty Font 
         Name            =   "隶书"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   735
      Left            =   480
      TabIndex        =   1
      Top             =   2760
      Width           =   2175
   End
   Begin VB.Label Label1 
      Appearance      =   0  'Flat
      BackColor       =   &H000080FF&
      BackStyle       =   0  'Transparent
      Caption         =   "新用户名称:"
      BeginProperty Font 
         Name            =   "隶书"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   615
      Left            =   480
      TabIndex        =   0
      Top             =   1560
      Width           =   2055
   End
End
Attribute VB_Name = "Form18"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Combo1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1.SetFocus
End If
End Sub

Private Sub Command1_Click()
  
    Dim sql As String
    Dim rs As ADODB.Recordset
    If Trim(UserName.Text) = "" Then                              '判断用户名称是否为空
        MsgBox "请输入用户名称!", vbOKOnly + vbExclamation, "警告"
        Exit Sub
        UserName.SetFocus
    Else
        sql = "select * from UserInfo where UserID='" & UserName & "'"
        Set rs = TransactSQL(sql)
        If rs.EOF = False Then                                    '判断是否已经存在用户
            MsgBox "这个用户已经存在!请重新输入用户名称!", vbOKOnly + vbExclamation, "警告"
            UserName.SetFocus
            UserName.Text = ""
            Password.Text = ""
            confirmPWD.Text = ""
            Exit Sub
        Else
            If Trim(Password.Text) <> Trim(confirmPWD.Text) Then  '判断两次密码是否相同
                MsgBox "两次输入的密码不一致,请重新输入密码!", vbOKOnly + vbExclamation, "警告"
                Password.Text = ""
                confirmPWD.Text = ""
                Password.SetFocus
                Exit Sub
            ElseIf Trim(Password.Text) = "" Then                  '判断密码是否为空
                MsgBox "密码不能为空!", vbOKOnly + vbExclamation, "警告"
                Password.Text = ""
                confirmPWD = ""
                Password.SetFocus
            Else                                                 '添加用户
                sql = "insert into UserInfo (UserID,UserPWD,userpower) values('" & UserName
                sql = sql & "','" & Password & "','" & Combo1 & "')"
                TransactSQL (sql)
                MsgBox "添加成功!", vbOKOnly + vbExclamation, "添加结果"
                qx = Combo1.Text                                               '重新设置初始化为空
                UserName.Text = ""
                Password.Text = ""
                confirmPWD.Text = ""
                Combo1.Text = ""
                UserName.SetFocus
            End If
        End If
    End If
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Form_Load()
    UserName.Text = ""
    Password.Text = ""
    confirmPWD.Text = ""
    Combo1.Text = ""
End Sub

⌨️ 快捷键说明

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