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

📄 adduser.frm

📁 简单的数据库系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form adduser 
   Caption         =   "adduser"
   ClientHeight    =   3660
   ClientLeft      =   4230
   ClientTop       =   2610
   ClientWidth     =   5385
   Icon            =   "adduser.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   3660
   ScaleWidth      =   5385
   ShowInTaskbar   =   0   'False
   Begin VB.Frame Frame2 
      Height          =   2415
      Left            =   120
      TabIndex        =   3
      Top             =   0
      Width           =   5055
      Begin VB.TextBox Text1 
         Height          =   495
         Left            =   2040
         TabIndex        =   6
         Top             =   240
         Width           =   2775
      End
      Begin VB.TextBox Text2 
         Height          =   495
         IMEMode         =   3  'DISABLE
         Left            =   2040
         PasswordChar    =   "*"
         TabIndex        =   5
         Top             =   960
         Width           =   2775
      End
      Begin VB.TextBox Text3 
         Height          =   495
         IMEMode         =   3  'DISABLE
         Left            =   2040
         PasswordChar    =   "*"
         TabIndex        =   4
         Top             =   1680
         Width           =   2775
      End
      Begin VB.Label Label1 
         Caption         =   "用  户  名"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00404040&
         Height          =   495
         Left            =   240
         TabIndex        =   9
         Top             =   360
         Width           =   1455
      End
      Begin VB.Label Label2 
         Caption         =   "用 户 密 码"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00404040&
         Height          =   495
         Left            =   240
         TabIndex        =   8
         Top             =   1080
         Width           =   1455
      End
      Begin VB.Label Label3 
         Caption         =   "验证用户密码"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00404040&
         Height          =   375
         Left            =   240
         TabIndex        =   7
         Top             =   1800
         Width           =   1695
      End
   End
   Begin VB.Frame Frame1 
      Height          =   975
      Left            =   120
      TabIndex        =   0
      Top             =   2520
      Width           =   5055
      Begin VB.CommandButton Command1 
         Caption         =   "确 定(&O)"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Left            =   960
         TabIndex        =   2
         Top             =   240
         Width           =   1335
      End
      Begin VB.CommandButton Command2 
         Caption         =   "关 闭(&C)"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   615
         Left            =   3120
         TabIndex        =   1
         Top             =   240
         Width           =   1335
      End
   End
End
Attribute VB_Name = "adduser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()

  If Not Testtxt(Text1.Text) Then
      MsgBox "请输入用户名!", 48, "提示"
      Text1.SetFocus
      Exit Sub
    End If
    If Not Testtxt(Text2.Text) Then
      MsgBox "请输入用户密码!", 48, "提示"
      Text2.SetFocus
      Exit Sub
    End If
      If Not Testtxt(Text3.Text) Then
      MsgBox "请输入验证密码!", 48, "提示"
      Text3.SetFocus
      Exit Sub
    End If
    
    txtSQL = "select * from user "
    Set dream = ExecuteSQL(txtSQL, Msgtext)
    While (dream.EOF = False)
     If Trim(dream.Fields(0)) = Trim(Text1) Then '判断是否有重复记录
       MsgBox "用户名已经存在,请重新输入用户名!", 48, "警告"
       Text1.SetFocus
       Text1.Text = ""
       Text2.Text = ""
       Text3.Text = ""
       Exit Sub
     Else
       dream.MoveNext '移动到下一条记录
     End If
  Wend

 If Len(Text2.Text) < 6 Then
    MsgBox "密码必须六位以上!", 48, "提示"
    Text2.SetFocus
    Text2.Text = ""
    Text3.Text = ""
 Else
   If Trim(Text2.Text) <> Trim(Text3.Text) Then
     '判断两次输入密码是否一致
    MsgBox "两次输入密码不一样,请确认!", 48, "警告"
    Text2.SetFocus
    Text2.Text = ""
    Text3.Text = ""
    Exit Sub
  Else
    If Text2.Text = "" Then '判断输入密码是否为空
      MsgBox "密码不能为空", 48, "警告"
      Text2.SetFocus
      Text2.SetFocus
      Text3.Text = ""
    Else
      dream.AddNew '添加新记录
      dream.Fields(0) = Trim(Text1.Text)
      dream.Fields(1) = Trim(Text2.Text)
      dream.Update '更新数据库
      dream.Close '关闭数据库
      Me.Hide
      MsgBox "添加用户成功!", 48, "添加用户"
    End If
 End If
End If
End Sub

Private Sub Command2_Click()
studentmdi.StatusBar1.Panels.Item(1).Text = " "
Unload Me
End Sub

Private Sub Form_Load()
adduser.Width = 5505
adduser.Height = 4065
adduser.Caption = "添加用户信息.....[" + Format(Date, "yyyy年mm月dd日]")
studentmdi.StatusBar1.Panels.Item(1).Text = "添加用户信息"
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 + -