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

📄 adduser.frm

📁 这是一个我帮师妹做的软件的大作业
💻 FRM
字号:
VERSION 5.00
Begin VB.Form addUse 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "用户注册"
   ClientHeight    =   2745
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   4095
   Icon            =   "addUser.frx":0000
   LinkTopic       =   "Form3"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2745
   ScaleWidth      =   4095
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  '窗口缺省
   Begin VB.Frame Frame1 
      Height          =   2535
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   3855
      Begin VB.CommandButton Command3 
         Caption         =   "退出"
         Height          =   375
         Left            =   2640
         TabIndex        =   13
         Top             =   2040
         Width           =   735
      End
      Begin VB.CommandButton Command2 
         Caption         =   "重填"
         Height          =   375
         Left            =   1560
         TabIndex        =   12
         Top             =   2040
         Width           =   735
      End
      Begin VB.CommandButton Command1 
         Caption         =   "注册"
         Height          =   375
         Left            =   480
         TabIndex        =   11
         Top             =   2040
         Width           =   735
      End
      Begin VB.Frame Frame3 
         Caption         =   "权限"
         Height          =   1815
         Left            =   2400
         TabIndex        =   8
         Top             =   0
         Width           =   1455
         Begin VB.OptionButton Option1 
            Caption         =   "普通用户"
            Height          =   255
            Index           =   1
            Left            =   240
            TabIndex        =   10
            Top             =   1080
            Width           =   1095
         End
         Begin VB.OptionButton Option1 
            Caption         =   "管理员"
            Height          =   255
            Index           =   0
            Left            =   240
            TabIndex        =   9
            Top             =   600
            Value           =   -1  'True
            Width           =   855
         End
      End
      Begin VB.Frame Frame2 
         Height          =   1815
         Left            =   0
         TabIndex        =   1
         Top             =   0
         Width           =   2535
         Begin VB.TextBox Text1 
            Appearance      =   0  'Flat
            BackColor       =   &H80000018&
            Height          =   350
            IMEMode         =   3  'DISABLE
            Index           =   2
            Left            =   1080
            MaxLength       =   20
            PasswordChar    =   "*"
            TabIndex        =   7
            Top             =   1200
            Width           =   1215
         End
         Begin VB.TextBox Text1 
            Appearance      =   0  'Flat
            BackColor       =   &H80000018&
            Height          =   350
            IMEMode         =   3  'DISABLE
            Index           =   1
            Left            =   1080
            MaxLength       =   20
            PasswordChar    =   "*"
            TabIndex        =   6
            Top             =   720
            Width           =   1215
         End
         Begin VB.TextBox Text1 
            Appearance      =   0  'Flat
            BackColor       =   &H80000018&
            Height          =   350
            Index           =   0
            Left            =   1080
            MaxLength       =   20
            TabIndex        =   5
            Top             =   240
            Width           =   1215
         End
         Begin VB.Label Label1 
            Caption         =   "确认密码:"
            Height          =   375
            Index           =   2
            Left            =   120
            TabIndex        =   4
            Top             =   1320
            Width           =   975
         End
         Begin VB.Label Label1 
            Caption         =   "密码:"
            Height          =   375
            Index           =   1
            Left            =   480
            TabIndex        =   3
            Top             =   840
            Width           =   615
         End
         Begin VB.Label Label1 
            Caption         =   "用户名:"
            Height          =   375
            Index           =   0
            Left            =   300
            TabIndex        =   2
            Top             =   360
            Width           =   735
         End
      End
   End
End
Attribute VB_Name = "addUse"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
Explode Me, 5000 ' open this form by number of desired increment
End Sub

Private Sub Command1_Click()
Dim txtSQL As String


If Trim(Text1(0).Text) = "" Then
MsgBox "请输入用户名!", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If

If Trim(Text1(1).Text) <> Trim(Text1(2).Text) Then
MsgBox "两次输入密码不一样,请确认!", vbOKOnly + vbExclamation, "警告"
Text1(1).SetFocus
Text1(1).Text = ""
Text1(2).Text = ""
Exit Sub

Else
If Text1(1).Text = "" Then
MsgBox "密码不能为空!", vbOKOnly + vbExclamation, "警告"
Text1(1).SetFocus
Text1(1).Text = ""
Text1(2).Text = ""
Else
Dim mrc As ADODB.Recordset
txtSQL = "select * from use where username='" & Trim(Text1(0).Text) & "'"
Set mrc = ExecuteSQL(txtSQL)
If mrc.EOF = False Then
MsgBox " 已存在该用户!", vbExclamation + vbOKOnly, "警告"
Text1(0).Text = ""
Text1(1).Text = ""
Text1(2).Text = ""
Text1(0).SetFocus
Text1(0).SelStart = 0
Text1(0).SelLength = Len(Text1(0).Text)
Exit Sub
End If
txtSQL = "select * from use"
Set mrc = ExecuteSQL(txtSQL)
mrc.AddNew
mrc.Fields(0) = Trim(Text1(0).Text)
mrc.Fields(1) = Trim(Text1(1).Text)
If Option1(0).Value Then
mrc.Fields(2) = Trim(Option1(0).Caption)
Else
mrc.Fields(2) = Trim(Option1(1).Caption)
End If
mrc.Update
mrc.Close
Me.Hide
MsgBox "添加用户成功!", vbOKOnly + vbExclamation, "添加用户"
frmMain.Enabled = True
frmMain.Visible = True
End If
End If
End Sub

Private Sub Command2_Click()
Text1(0).Text = ""
Text1(1).Text = ""
Text1(2).Text = ""
Text1(0).SelStart = 0
Text1(0).SelLength = Len(Text1(0).Text)
End Sub

Private Sub Command3_Click()
For i = 1 To Me.Height / 2
Me.Height = Me.Height - 30
Next i
horiz:
Me.Height = 30
gotoval = Me.Height
For gointi = 1 To gotoval
DoEvents
Me.Width = Me.Width - 30
If Me.Width <= 11 Then End
Next gointi
Unload Me
End Sub



Private Sub Form_Unload(Cancel As Integer)
frmMain.Enabled = True
End Sub

⌨️ 快捷键说明

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