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

📄 frmusradd.frm

📁 <Visual Basic 数据库开发实例精粹(第二版)>一书首先介绍了Visual Basic(简称VB)开发的技巧和重点技术
💻 FRM
字号:
VERSION 5.00
Begin VB.Form FrmUsrAdd 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "添加管理员"
   ClientHeight    =   3495
   ClientLeft      =   45
   ClientTop       =   360
   ClientWidth     =   3720
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   ScaleHeight     =   3495
   ScaleWidth      =   3720
   Begin VB.CommandButton CmdCancel 
      Cancel          =   -1  'True
      Caption         =   "取消"
      Height          =   375
      Left            =   2400
      TabIndex        =   11
      Top             =   3000
      Width           =   1215
   End
   Begin VB.TextBox TextName 
      Height          =   375
      IMEMode         =   3  'DISABLE
      Left            =   1560
      TabIndex        =   10
      Top             =   1560
      Width           =   2055
   End
   Begin VB.TextBox TextID 
      Height          =   375
      Left            =   1560
      TabIndex        =   4
      Top             =   600
      Width           =   2055
   End
   Begin VB.ComboBox CbType 
      Height          =   300
      ItemData        =   "FrmUsrAdd.frx":0000
      Left            =   1560
      List            =   "FrmUsrAdd.frx":000D
      Style           =   2  'Dropdown List
      TabIndex        =   3
      Top             =   1125
      Width           =   2055
   End
   Begin VB.TextBox TextAddPwd1 
      Height          =   375
      IMEMode         =   3  'DISABLE
      Left            =   1560
      PasswordChar    =   "*"
      TabIndex        =   2
      Top             =   2040
      Width           =   2055
   End
   Begin VB.TextBox TextAddPwd2 
      Height          =   375
      IMEMode         =   3  'DISABLE
      Left            =   1560
      PasswordChar    =   "*"
      TabIndex        =   1
      Top             =   2565
      Width           =   2055
   End
   Begin VB.CommandButton CmdAddOk 
      Caption         =   "添加"
      Height          =   375
      Left            =   1080
      TabIndex        =   0
      Top             =   3000
      Width           =   1215
   End
   Begin VB.Label Label6 
      Caption         =   "请输入管理员的详细信息:"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   375
      Left            =   120
      TabIndex        =   12
      Top             =   120
      Width           =   3495
   End
   Begin VB.Label Label1 
      Caption         =   "管理员ID:"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   375
      Left            =   120
      TabIndex        =   9
      Top             =   600
      Width           =   1815
   End
   Begin VB.Label Label2 
      Caption         =   "类型:"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   375
      Left            =   600
      TabIndex        =   8
      Top             =   1080
      Width           =   975
   End
   Begin VB.Label Label3 
      Caption         =   "姓名:"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   375
      Left            =   600
      TabIndex        =   7
      Top             =   1560
      Width           =   975
   End
   Begin VB.Label Label4 
      Caption         =   "密码:"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   375
      Left            =   600
      TabIndex        =   6
      Top             =   2040
      Width           =   855
   End
   Begin VB.Label Label5 
      Caption         =   "密码确认:"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   375
      Left            =   120
      TabIndex        =   5
      Top             =   2520
      Width           =   1455
   End
End
Attribute VB_Name = "FrmUsrAdd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'添加管理员
Private Sub CmdAddOk_Click()
Dim str As String
    '检验输入内容
    If Len(Trim(Me.TextID.Text)) <= 0 Then
        MsgBox "请输入管理员ID!"
        Exit Sub
    ElseIf Len(Trim(Me.TextID.Text)) > 16 Then
        MsgBox "您输入的管理员ID过长!"
        Exit Sub
    End If
    If Len(Trim(Me.TextName.Text)) <= 0 Then
        MsgBox "请输入管理员姓名!"
        Exit Sub
    ElseIf Len(Trim(Me.TextName.Text)) > 4 Then
        MsgBox "您输入的姓名过长!"
        Exit Sub
    End If
     If Len(Trim(Me.TextAddPwd1.Text)) <= 0 Then
        MsgBox "请输入密码!"
        Exit Sub
    ElseIf Len(Trim(Me.TextAddPwd1.Text)) > 16 Then
        MsgBox "您输入密码过长!"
        Exit Sub
    End If
    If Trim(Me.TextAddPwd1.Text) <> Trim(Me.TextAddPwd2.Text) Then
        MsgBox "两次输入的密码不一致!"
        Exit Sub
    End If
    '生成要发送的数据 = Usr,01,Usr_ID,Usr_Name,Usr_Pwd,Usr_Type
    str = "Usr,01,"
    str = str & Me.TextID.Text & ","
    str = str & Me.TextName.Text & ","
    str = str & Me.TextAddPwd1.Text & ","
    str = str & Val(Me.CbType.Text)
    '检验sock连接并向服务器发送数据
    If MDIFrm.SockToSvr.State <> sckConnected Then
        MsgBox "还没有连接数据库,不能发送请求!"
        Exit Sub
    End If
    MDIFrm.SockToSvr.SendData str
    Unload Me
End Sub

Private Sub CmdCancel_Click()   '取消
    Unload Me
End Sub

⌨️ 快捷键说明

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