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

📄 frmnew.frm

📁 OA编程 源代码
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmNew 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "新用户"
   ClientHeight    =   3885
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6435
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3885
   ScaleWidth      =   6435
   StartUpPosition =   2  '屏幕中心
   Begin VB.TextBox Text2 
      Height          =   1125
      Left            =   1920
      TabIndex        =   8
      Top             =   1800
      Width           =   4245
   End
   Begin VB.CommandButton CmdClose 
      Caption         =   "关闭"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   405
      Left            =   4440
      TabIndex        =   7
      Top             =   3300
      Width           =   1725
   End
   Begin VB.CommandButton CmdSave 
      Caption         =   "添加"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   405
      Left            =   1800
      TabIndex        =   6
      Top             =   3300
      Width           =   1485
   End
   Begin VB.TextBox Text4 
      Height          =   375
      IMEMode         =   3  'DISABLE
      Left            =   1890
      PasswordChar    =   "*"
      TabIndex        =   2
      Top             =   1230
      Width           =   4215
   End
   Begin VB.TextBox Text3 
      Height          =   375
      Left            =   1890
      TabIndex        =   1
      Top             =   750
      Width           =   4215
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   1890
      TabIndex        =   0
      Top             =   180
      Width           =   4215
   End
   Begin VB.Label label2 
      AutoSize        =   -1  'True
      BackColor       =   &H80000013&
      Caption         =   "备注:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Left            =   1170
      TabIndex        =   9
      Top             =   1830
      Width           =   525
   End
   Begin VB.Label Label4 
      AutoSize        =   -1  'True
      BackColor       =   &H80000013&
      Caption         =   "密码:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Left            =   1170
      TabIndex        =   5
      Top             =   1410
      Width           =   525
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      BackColor       =   &H80000013&
      Caption         =   "用户名(中文):"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Left            =   330
      TabIndex        =   4
      Top             =   870
      Width           =   1365
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackColor       =   &H80000013&
      Caption         =   "用户ID:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Left            =   960
      TabIndex        =   3
      Top             =   240
      Width           =   735
   End
End
Attribute VB_Name = "frmNew"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub CmdClose_Click()
    Unload Me
    Call SetGride(frmUserMain.GrdUser, frmUserMain.GrdGroup)
End Sub

Private Sub CmdSave_Click()
    Dim str As String
    Dim tempPsw As String
    
    '判断输入的数据是否正确
    If Trim(Text1.Text) = "" Then
        MsgBox "用户名不能为空!", 48, "系统提示"
        Exit Sub
    ElseIf Trim(Text3.Text) = "" Then
        MsgBox "用户名不能为空!", 48, "系统提示"
        Exit Sub
    End If
    If lstrlen(Trim(Text4.Text)) > 50 Then
        MsgBox "用户密码最多只能输入50个字符!", 48, "用户管理器"
        Exit Sub
    End If

    str = "select username from userbase where username='" & Trim(Text1.Text) & "'"
    Set RstUser = Pubsaconn.Execute(str)
    If Not RstUser.EOF Then
        MsgBox "该用户名已存在,请输入不同的名字!", 48, "用户管理器"
        Exit Sub
    End If
    
    str = "insert into userbase values('" & Trim(Text1.Text) _
    & "','" & Trim(Text3.Text) & "','','" & Trim(Text4.Text) _
    & "','" & Trim(Text2.Text) & "')"
    Pubsaconn.Execute str, 64
    
    Text1.Text = ""
    Text2.Text = ""
    Text3.Text = ""
    Text4.Text = ""
    
    Text1.SetFocus
    
End Sub

⌨️ 快捷键说明

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