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

📄 main_xtgl_czysz.frm

📁 是基于C#语言的一个图书综合管理系统的开发案例,相当实用
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form main_xtgl_czysz 
   BackColor       =   &H00C1FFEB&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "系统管理-【添加操作员】"
   ClientHeight    =   3960
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   5775
   Icon            =   "main_xtgl_czysz.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3960
   ScaleWidth      =   5775
   StartUpPosition =   1  '所有者中心
   Begin VB.Frame Frame1 
      BackColor       =   &H00C1FFEB&
      Height          =   3345
      Left            =   120
      TabIndex        =   4
      Top             =   75
      Width           =   5595
      Begin MSComctlLib.ImageCombo ImageCombo1 
         Height          =   480
         Left            =   1500
         TabIndex        =   12
         Top             =   2745
         Width           =   3780
         _ExtentX        =   6668
         _ExtentY        =   847
         _Version        =   393216
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         ImageList       =   "ImageList1"
      End
      Begin VB.TextBox TxtOk 
         BackColor       =   &H00FFFFFF&
         Height          =   330
         IMEMode         =   3  'DISABLE
         Left            =   1515
         MaxLength       =   50
         PasswordChar    =   "*"
         TabIndex        =   9
         Top             =   1740
         Width           =   3810
      End
      Begin VB.TextBox TxtMM 
         BackColor       =   &H00FFFFFF&
         Height          =   330
         IMEMode         =   3  'DISABLE
         Left            =   1530
         MaxLength       =   50
         PasswordChar    =   "*"
         TabIndex        =   8
         Top             =   1260
         Width           =   3810
      End
      Begin VB.TextBox TxtCZY 
         BackColor       =   &H00FFFFFF&
         Height          =   330
         Left            =   1530
         TabIndex        =   7
         Top             =   720
         Width           =   3810
      End
      Begin VB.TextBox TxtBH 
         BackColor       =   &H00FFFFFF&
         Height          =   330
         Left            =   1530
         Locked          =   -1  'True
         TabIndex        =   6
         Top             =   240
         Width           =   3810
      End
      Begin VB.ComboBox Combo1 
         Height          =   300
         Left            =   1530
         TabIndex        =   5
         Top             =   2310
         Width           =   3810
      End
      Begin MSComctlLib.ImageList ImageList1 
         Left            =   465
         Top             =   2775
         _ExtentX        =   1005
         _ExtentY        =   1005
         BackColor       =   -2147483643
         ImageWidth      =   26
         ImageHeight     =   26
         MaskColor       =   12632256
         _Version        =   393216
         BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
            NumListImages   =   10
            BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "main_xtgl_czysz.frx":0CCA
               Key             =   "头像1"
            EndProperty
            BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "main_xtgl_czysz.frx":48DA
               Key             =   "头像2"
            EndProperty
            BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "main_xtgl_czysz.frx":855A
               Key             =   "头像3"
            EndProperty
            BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "main_xtgl_czysz.frx":C398
               Key             =   "头像4"
            EndProperty
            BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "main_xtgl_czysz.frx":FFFE
               Key             =   "头像5"
            EndProperty
            BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "main_xtgl_czysz.frx":14093
               Key             =   "头像6"
            EndProperty
            BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "main_xtgl_czysz.frx":17ED7
               Key             =   "头像7"
            EndProperty
            BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "main_xtgl_czysz.frx":1BBA6
               Key             =   "头像8"
            EndProperty
            BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "main_xtgl_czysz.frx":1FA07
               Key             =   "头像9"
            EndProperty
            BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "main_xtgl_czysz.frx":236BC
               Key             =   "头像10"
            EndProperty
         EndProperty
      End
      Begin VB.Label Label2 
         BackStyle       =   0  'Transparent
         Caption         =   "编    号                             操作员                             密    码                            确    认"
         Height          =   1875
         Left            =   225
         TabIndex        =   11
         Top             =   285
         Width           =   1005
      End
      Begin VB.Label Label1 
         BackStyle       =   0  'Transparent
         Caption         =   "级别设置                                     头像设置                     "
         Height          =   1380
         Left            =   225
         TabIndex        =   10
         Top             =   2400
         Width           =   1290
      End
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   330
      Left            =   4545
      Top             =   4605
      Visible         =   0   'False
      Width           =   1200
      _ExtentX        =   2117
      _ExtentY        =   582
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   3
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   "DSN=Nbooks"
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   "Nbooks"
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   "select * from qxb"
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.CommandButton CmdAdd 
      BackColor       =   &H80000016&
      Caption         =   "添加"
      Height          =   375
      Left            =   1395
      Style           =   1  'Graphical
      TabIndex        =   3
      Top             =   3465
      Width           =   1080
   End
   Begin VB.CommandButton CmdCancel 
      BackColor       =   &H80000016&
      Caption         =   "取消"
      Height          =   375
      Left            =   3555
      Style           =   1  'Graphical
      TabIndex        =   2
      Top             =   3465
      Width           =   1080
   End
   Begin VB.CommandButton CmdOk 
      BackColor       =   &H80000016&
      Caption         =   "确定"
      Height          =   375
      Left            =   2475
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   3465
      Width           =   1080
   End
   Begin VB.CommandButton CmdEnd 
      BackColor       =   &H80000016&
      Caption         =   "退出"
      Height          =   375
      Left            =   4635
      Style           =   1  'Graphical
      TabIndex        =   0
      Top             =   3465
      Width           =   1080
   End
End
Attribute VB_Name = "main_xtgl_czysz"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Form_Load()
    '自动识别路径
    Adodc1.ConnectionString = "DSN=NBooks"
    Adodc1.RecordSource = "select * from qxb"
    Adodc1.Refresh
    Dim NewItem As ComboItem     '声明一个ComboItem对象
    Dim i As Integer     '声明一个整型变量
    Combo1.AddItem ("系统管理员")   '向Combo控件中添加数据项
    Combo1.AddItem ("高级操作员")   '向Combo控件中添加数据项
    Combo1.AddItem ("普通操作员")   '向Combo控件中添加数据项
    For i = 1 To 10
        Set NewItem = ImageCombo1.ComboItems.Add(i, "头像" & i, "头像" & i, "头像" & i)
    Next i
End Sub
Private Sub Form_Unload(Cancel As Integer)
 frm_main.Enabled = True
End Sub
Private Sub TxtBH_KeyDown(KeyCode As Integer, Shift As Integer)
 If KeyCode = vbKeyReturn Then TxtBH.SetFocus     '回车TxtBH获得焦点
End Sub
Private Sub TxtCZY_KeyDown(KeyCode As Integer, Shift As Integer)
 If KeyCode = vbKeyReturn Then TxtMM.SetFocus     '回车TxtMM获得焦点
End Sub
Private Sub TxtMM_KeyDown(KeyCode As Integer, Shift As Integer)
 If KeyCode = vbKeyReturn Then TxtOk.SetFocus     '回车TxtOk获得焦点
End Sub
Private Sub TxtOk_KeyDown(KeyCode As Integer, Shift As Integer)
 If KeyCode = vbKeyReturn Then Combo1.SetFocus     '回车Combo1获得焦点
End Sub
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
 If KeyCode = vbKeyReturn Then ImageCombo1.SetFocus  '回车ImageCombo获得焦点
End Sub
Private Sub ImageCombo1_KeyDown(KeyCode As Integer, Shift As Integer)
 If KeyCode = vbKeyReturn Then cmdOK.SetFocus     '回车CmdOk获得焦点
End Sub
Private Sub CmdAdd_Click()   '添加
    Adodc1.RecordSource = "select * from qxb"
    Adodc1.Refresh
    If Adodc1.Recordset.RecordCount > 0 Then    '如果数据记录大于零
        Adodc1.Recordset.MoveLast     '移至最后一条记录
        TxtBH.text = Format(Val(Adodc1.Recordset.Fields("编号")) + 1, "00")
        'Format 函数返回 Variant (String),其中含有一个表达式,它是根据格式表达式中的指令来格式化的。
    Else
        TxtBH.text = "01"
    End If
    TxtCZY.SetFocus   '设置焦点
End Sub

Private Sub cmdOK_Click()  '确定
    '保存操作员及密码
    If TxtCZY.text = "" Then
        MsgBox "系统不允许操作员为空!", , "图书综合管理系统"
        Exit Sub
    End If
    If TxtMM.text = "" Then
        MsgBox "密码不允许为空!", , "图书综合管理系统"
        Exit Sub
    End If
    If TxtOk.text = "" Then
        MsgBox "确认密码不允许为空!", , "图书综合管理系统"
        Exit Sub
    End If
    If TxtOk.text <> TxtMM.text Then
        MsgBox "密码与确认密码不同,请重新输入!", , "图书综合管理系统"
        Exit Sub
    End If
    If Combo1.text = "" Then
        MsgBox "操作员级别不允许为空!", , "图书综合管理系统"
        Exit Sub
    End If
    If ImageCombo1.text = "" Then
        MsgBox "操作员头像不允许为空!", , "图书综合管理系统"
        Exit Sub
    End If
    Adodc1.RecordSource = "select * from qxb where 操作员='" + TxtCZY.text + "'"
    Adodc1.Refresh
    With Adodc1.Recordset
        If .RecordCount > 0 Then   '如果数据记录大于零
            MsgBox "此操作员已存在,请重新输入!", , "图书综合管理系统"
        Else
            Adodc1.Recordset.Close
            Adodc1.Recordset.Open "select * from qxb", Cnn, 0, 3
            .AddNew
            .Fields("编号") = TxtBH.text
            .Fields("操作员") = TxtCZY.text
            .Fields("密码") = TxtMM.text
            .Fields("操作员级别") = Combo1.text
            .Fields("头像") = ImageCombo1.text
            .Update     '更新记录
            '清空控件信息
            TxtBH.text = ""
            TxtCZY.text = ""
            TxtMM.text = ""
            TxtOk.text = ""
            Combo1.text = ""
            ImageCombo1.text = ""
        End If
    End With
End Sub
Private Sub CmdCancel_Click()   '取消按钮
' 清空控件信息
 TxtBH.text = ""
 TxtCZY.text = ""
 TxtMM.text = ""
 TxtOk.text = ""
 Combo1.text = ""
 ImageCombo1.text = ""
End Sub
Private Sub CmdEnd_Click()   '退出
 frm_main.Enabled = True
 Unload Me
End Sub

⌨️ 快捷键说明

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