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

📄 frmreadermessage.frm

📁 这是图书馆管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmreadermessage 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   " 读者登记"
   ClientHeight    =   2520
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   7395
   BeginProperty Font 
      Name            =   "宋体"
      Size            =   10.5
      Charset         =   134
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   Icon            =   "frmreadermessage.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   2520
   ScaleWidth      =   7395
   ShowInTaskbar   =   0   'False
   Begin VB.CommandButton Cmdlast 
      Caption         =   ">|"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   2760
      TabIndex        =   21
      Top             =   2040
      Width           =   975
   End
   Begin VB.CommandButton Cmdfirst 
      Caption         =   "|<"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   240
      TabIndex        =   20
      Top             =   2040
      Width           =   855
   End
   Begin VB.CommandButton Cmdclose 
      Caption         =   "关闭"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   6480
      TabIndex        =   19
      Top             =   2040
      Width           =   615
   End
   Begin VB.CommandButton Cmdsave 
      Caption         =   "保存"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   5640
      TabIndex        =   18
      Top             =   2040
      Width           =   615
   End
   Begin VB.CommandButton Cmdremove 
      Caption         =   "删除"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   5040
      TabIndex        =   17
      Top             =   2040
      Width           =   615
   End
   Begin VB.Frame Frame2 
      Height          =   615
      Left            =   4560
      TabIndex        =   11
      Top             =   840
      Width           =   2055
      Begin VB.OptionButton Optduty 
         Caption         =   "职员"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Index           =   1
         Left            =   1080
         TabIndex        =   15
         Top             =   240
         Width           =   735
      End
      Begin VB.OptionButton Optduty 
         Caption         =   "经理"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   300
         Index           =   0
         Left            =   240
         TabIndex        =   14
         Top             =   240
         Value           =   -1  'True
         Width           =   1215
      End
   End
   Begin VB.Frame Frame1 
      Height          =   615
      Left            =   4560
      TabIndex        =   10
      Top             =   120
      Width           =   2055
      Begin VB.OptionButton Optsex 
         Caption         =   "女"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   180
         Index           =   1
         Left            =   1080
         TabIndex        =   13
         Top             =   240
         Width           =   735
      End
      Begin VB.OptionButton Optsex 
         Caption         =   "男"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   180
         Index           =   0
         Left            =   240
         TabIndex        =   12
         Top             =   240
         Value           =   -1  'True
         Width           =   735
      End
   End
   Begin VB.CommandButton Cmdnext 
      Caption         =   ">"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   1920
      TabIndex        =   9
      Top             =   2040
      Width           =   855
   End
   Begin VB.TextBox Txtage 
      Height          =   315
      Left            =   1200
      TabIndex        =   8
      Top             =   1440
      Width           =   1095
   End
   Begin VB.TextBox Txtreadername 
      Height          =   315
      Left            =   1200
      TabIndex        =   6
      Top             =   840
      Width           =   1815
   End
   Begin VB.TextBox Txtreaderindex 
      Height          =   315
      Left            =   1200
      TabIndex        =   5
      Top             =   300
      Width           =   1815
   End
   Begin VB.CommandButton Cmdprev 
      Caption         =   "<"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   1080
      TabIndex        =   0
      Top             =   2040
      Width           =   855
   End
   Begin VB.CommandButton Cmdenter 
      Caption         =   "登记"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   4440
      TabIndex        =   16
      Top             =   2040
      Width           =   615
   End
   Begin VB.Label Lblage 
      AutoSize        =   -1  'True
      Caption         =   "年龄"
      Height          =   210
      Left            =   240
      TabIndex        =   7
      Top             =   1560
      Width           =   420
   End
   Begin VB.Label Lblduty 
      AutoSize        =   -1  'True
      Caption         =   "职    务"
      Height          =   210
      Left            =   3600
      TabIndex        =   4
      Top             =   960
      Width           =   840
   End
   Begin VB.Label Lblsex 
      AutoSize        =   -1  'True
      Caption         =   "性    别"
      Height          =   210
      Left            =   3600
      TabIndex        =   3
      Top             =   360
      Width           =   840
   End
   Begin VB.Label Lblreadername 
      AutoSize        =   -1  'True
      Caption         =   "读者姓名"
      Height          =   210
      Left            =   240
      TabIndex        =   2
      Top             =   960
      Width           =   840
   End
   Begin VB.Label Lblreaderindex 
      AutoSize        =   -1  'True
      Caption         =   "读者编号"
      Height          =   210
      Left            =   240
      TabIndex        =   1
      Top             =   360
      Width           =   840
   End
End
Attribute VB_Name = "frmreadermessage"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Cmdclose_Click()
    Unload Me
End Sub
Private Sub Form_Load()
    If g_DBRct.State = adStateOpen Then
        g_DBRct.Close
    End If
    Call g_DBRct.Open("select * from readermessage", g_DBCon, adOpenDynamic, adLockOptimistic, -1)
    If g_DBRct.EOF And g_DBRct.BOF Then
        Txtreaderindex.Text = 1
        '如果读者库为空,则生成读者编号为一
    Else
        g_DBRct.MoveLast
        Txtreaderindex.Text = g_DBRct!readerindex + 1
        '窗体加载时,自动生成读者的编号
    End If
   
End Sub
Private Sub ShowData()
    Txtreaderindex.Text = g_DBRct!readerindex
    Txtreadername.Text = g_DBRct!readername
    If g_DBRct!sex = 1 Then
        Optsex(0).Value = True
    Else
        Optsex(1).Value = True
    End If
    If g_DBRct!duty = 1 Then
        Optduty(0).Value = True
    Else
        Optduty(1).Value = True
    End If
    Txtage.Text = g_DBRct!age
   
End Sub
Private Sub Cmdsave_Click()
            '判断输入的数据是否完整
    Dim strInsertSQL As String
    Dim strsex As Integer
    Dim strduty As Integer
    Dim s1 As String
    Dim s2 As String
    If Optsex(0).Value = True Then
        strsex = 1
        s1 = "男"
    Else
        strsex = 0
        s1 = "女"
    End If
    If Optduty(0).Value = True Then
        strduty = 1
        s2 = "经理"
    Else
        strduty = 0
        s2 = "职员"
    End If
    If (Trim(Txtreadername.Text) = Empty) _
        Or Optsex(0).Value = False And Optsex(1).Value = False _
        Or Optduty(0).Value = False And Optduty(1).Value = False _
        Or (Trim(Txtage.Text) = Empty) Then
        MsgBox "请输入所有的数据...", vbInformation + vbOKOnly, "读者资料不完整"
            ' 弹出消息框,判断输入的数据是否准确,如果准确向数据库中导入数据
    ElseIf MsgBox("读者姓名:" & Trim(Txtreadername.Text) & vbCrLf & _
                      "读者性别:" & s1 & vbCrLf & _
                      "职务:" & s2 & vbCrLf & _
                      "年龄:" & Trim(Txtage.Text) _
                            , vbOKCancel + vbInformation, "图书资料确认") = vbOK Then
        strInsertSQL = "INSERT INTO ReaderMessage(Readername,Sex,Duty,Age) VALUES ("
        strInsertSQL = strInsertSQL & "'" & Trim(Txtreadername.Text) & "'"
        strInsertSQL = strInsertSQL & "," & strsex
        strInsertSQL = strInsertSQL & "," & strduty
        strInsertSQL = strInsertSQL & ",'" & Trim(Txtage.Text) & "')"
            '向读者库中插入数据,调用模块中的函数
        If QueryEmpInfo(strInsertSQL) = True Then
            MsgBox "图书资料已保存...", vbInformation + vbOKOnly, "保存成功"
            Txtreadername.Text = ""
            Txtage.Text = ""
        End If
    End If
    Cmdenter.Enabled = True
    If g_DBRct.State = 1 Then
        g_DBRct.Close
        Set g_DBRct = Nothing
    End If
    '每次保存数据后,将记录集关闭,清空,重新打开
    g_DBRct.Open "readermessage", g_DBCon, adOpenDynamic, adLockOptimistic
End Sub
Private Sub Cmdnext_Click()
    '下一个按纽的单击事件
    If g_DBRct.BOF = False And g_DBRct.EOF = False Then
        g_DBRct.MoveNext
         If g_DBRct.EOF = True Then
            g_DBRct.MoveFirst
        End If
        Call ShowData
    End If
End Sub
Private Sub Cmdprev_Click()
    '上一个按纽的单击事件
    If g_DBRct.BOF = False And g_DBRct.EOF = False Then
        g_DBRct.MovePrevious
        If g_DBRct.BOF = True Then
            g_DBRct.MoveLast
        End If
        Call ShowData
    End If
End Sub
Private Sub Cmdfirst_Click()
    '第一个按纽的单击事件
    If g_DBRct.BOF = False And g_DBRct.EOF = False Then
        g_DBRct.MoveFirst
        Call ShowData
    End If
End Sub
Private Sub Cmdlast_Click()
    '最后一个按纽的单击事件
    If g_DBRct.BOF = False And g_DBRct.EOF = False Then
        g_DBRct.MoveLast
        Call ShowData
    End If
End Sub
Private Sub Cmdenter_Click()
    '新读者登记时,自动生成读者的编号
    g_DBRct.MoveLast
    Dim x As Integer
    x = g_DBRct!readerindex
    Txtreaderindex.Text = x + 1
    If Val(Txtreaderindex.Text) = x + 1 Then
        Cmdenter.Enabled = False
    End If
    Cmdenter.Enabled = False
    Txtreadername.Text = Empty
    Txtage.Text = Empty
    
End Sub
Private Sub Cmdremove_Click()
    If g_DBRct.EOF And g_DBRct.BOF Then
        MsgBox "读者资料库为空!"
        Cmdremove.Enabled = False
    ElseIf MsgBox("确实要删除该图书的信息吗?", vbQuestion + vbYesNo, "删除信息") = vbYes Then
        Cmdremove.Enabled = True
        g_DBRct.Delete
        
        Call Cmdnext_Click
    End If
    Txtreaderindex.Text = ""
    Txtreadername.Text = ""
    Txtage.Text = ""
End Sub



⌨️ 快捷键说明

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