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

📄 form10.frm

📁 本宿舍管理系统采用VB为系统开发平台
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form Form10 
   Caption         =   "Form10"
   ClientHeight    =   7755
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   10035
   LinkTopic       =   "Form10"
   ScaleHeight     =   7755
   ScaleWidth      =   10035
   StartUpPosition =   3  '窗口缺省
   Begin VB.Frame Frame2 
      Caption         =   "Frame2"
      Height          =   5175
      Left            =   120
      TabIndex        =   7
      Top             =   2520
      Width           =   9855
      Begin MSComctlLib.TreeView TreeView1 
         Height          =   4935
         Left            =   120
         TabIndex        =   9
         Top             =   240
         Width           =   2415
         _ExtentX        =   4260
         _ExtentY        =   8705
         _Version        =   393217
         Style           =   7
         Appearance      =   1
      End
      Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1 
         Height          =   4935
         Left            =   2640
         TabIndex        =   8
         Top             =   240
         Width           =   7095
         _ExtentX        =   12515
         _ExtentY        =   8705
         _Version        =   393216
         Rows            =   9
         Cols            =   9
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "Frame1"
      Height          =   1335
      Left            =   120
      TabIndex        =   0
      Top             =   1080
      Width           =   9855
      Begin VB.CommandButton Cmd_BS_exit 
         Caption         =   "退出(&E)"
         Height          =   375
         Left            =   7320
         TabIndex        =   14
         Top             =   720
         Width           =   1215
      End
      Begin VB.CommandButton Cmd_Book_del 
         Caption         =   "删除"
         Height          =   375
         Left            =   5520
         TabIndex        =   13
         Top             =   720
         Width           =   1215
      End
      Begin VB.CommandButton Cmd_Book_print 
         Caption         =   "预览/打印"
         Height          =   375
         Left            =   4080
         TabIndex        =   12
         Top             =   720
         Width           =   1215
      End
      Begin VB.CommandButton Cmd_Book_clear 
         Caption         =   "清空"
         Height          =   375
         Left            =   2400
         TabIndex        =   11
         Top             =   720
         Width           =   1215
      End
      Begin VB.CommandButton Cmd_Book_search 
         Caption         =   "查询(&S)"
         Default         =   -1  'True
         Height          =   375
         Left            =   840
         TabIndex        =   10
         Top             =   720
         Width           =   1215
      End
      Begin VB.ComboBox Combo1 
         Height          =   300
         Left            =   600
         TabIndex        =   6
         Text            =   "Combo1"
         Top             =   240
         Width           =   1095
      End
      Begin MSComCtl2.DTPicker DTPicker2 
         Height          =   255
         Left            =   2520
         TabIndex        =   5
         Top             =   360
         Width           =   735
         _ExtentX        =   1296
         _ExtentY        =   450
         _Version        =   393216
         Format          =   25362433
         CurrentDate     =   38778
      End
      Begin MSComCtl2.DTPicker DTPicker1 
         Height          =   255
         Left            =   2520
         TabIndex        =   4
         Top             =   120
         Width           =   735
         _ExtentX        =   1296
         _ExtentY        =   450
         _Version        =   393216
         Format          =   25362433
         CurrentDate     =   38778
      End
      Begin VB.TextBox Text1 
         Height          =   375
         Left            =   2760
         TabIndex        =   3
         Text            =   "Text1"
         Top             =   240
         Width           =   1575
      End
      Begin VB.Label Label2 
         Caption         =   "关键词"
         Height          =   255
         Left            =   1800
         TabIndex        =   2
         Top             =   240
         Width           =   855
      End
      Begin VB.Label Label1 
         Caption         =   "选项"
         Height          =   255
         Left            =   120
         TabIndex        =   1
         Top             =   240
         Width           =   615
      End
   End
End
Attribute VB_Name = "Form10"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub renew()
    Combo1.Text = Combo1.List(0)
    Text1.Text = "关键字"
    Text1.Visible = True
    DTPicker1.Visible = False
    DTPicker2.Visible = False
    Cmd_Book_del.Enabled = False
End Sub
Private Sub MSHGridset()
    MSHFlexGrid1.TextMatrix(0, 0) = "图书编号"
    MSHFlexGrid1.TextMatrix(0, 1) = "图书名称"
    MSHFlexGrid1.TextMatrix(0, 2) = "图书分类"
    MSHFlexGrid1.TextMatrix(0, 3) = "出版社"
    MSHFlexGrid1.TextMatrix(0, 4) = "图书价格"
    MSHFlexGrid1.TextMatrix(0, 5) = "图书进价)"
    MSHFlexGrid1.TextMatrix(0, 6) = "图书售价"
    MSHFlexGrid1.TextMatrix(0, 7) = "图书数量"
    MSHFlexGrid1.TextMatrix(0, 8) = "入库时间"
    MSHFlexGrid1.TextMatrix(0, 9) = "备注"
End Sub

Private Sub Cmd_Book_del_Click()
Dim bid As String
bid = "BOOK_ID='" + MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 0) + "'"

If rds_jieyue.State = adStateOpen Then rds_jieyue.Close

rds_jieyue.Open "select * from 借阅信息 where " + bid, myconn, adOpenKeyset, adLockOptimistic, 1

If rds_jieyue.RecordCount > 0 Then
    If MsgBox("此图书尚末归还,确认要删除吗" + vbCrLf + vbCrLf + "确认 删除" + vbCrLf + "否   取消", vbInformation + vbYesNo, "图书删除") = vbNo Then Exit Sub
End If

If MsgBox("确认真的要删除该图书吗", vbCritical + vbYesNo, "删除") = vbYes Then
        myconn.Execute "delete * from 图书信息 where " + bid
        MsgBox "删除成功"
        Call Cmd_Book_clear_Click   '重置
        
End If


End Sub

Private Sub Combo1_Click()
    If Combo1.Text = "出版日期" Or Combo1.Text = "登记日期" Then
        Text1.Visible = False
        DTPicker1.Visible = True
        DTPicker2.Visible = True
    Else
        Text1.Visible = True
        DTPicker1.Visible = False
        DTPicker2.Visible = False
    End If
End Sub

Private Sub Cmd_BS_exit_Click() '退出
Call renew
Unload Me
MDIMain.StatusBar1.Panels(3) = ""
End Sub
Private Sub Cmd_Book_search_Click() '查询
Dim search_item As String
Cmd_Book_del.Enabled = False '删除不可用

If Text1.Visible And Text1 = "关键字" Or Text1 = "" Then
        MsgBox "请输入关键字"
        Text1.SetFocus
        Text1.SelStart = 0
        Text1.SelLength = Len(Combo1)
        Exit Sub
End If
If Combo1.Text = "请选择……" Then
    MsgBox "请选择查询选项"
    Combo1.SetFocus
    Exit Sub
Else
    If Combo1.Text = "图书编号" Then search_item = "BOOK_ID like '"
    If Combo1.Text = "图书名称" Then search_item = "BOOK_NAME like '"
    If Combo1.Text = "图书类别" Then search_item = "BOOK_SORT like '"
    If Combo1.Text = "出版日期" Then search_item = "BOOK_DATE between #"
    If Combo1.Text = "价格范围" Then search_item = "BOOK_PRICE like '"
    If Combo1.Text = "作者" Then search_item = "BOOK_WRITER like '"
    If Combo1.Text = "出版社" Then search_item = "BOOK_CONCERN like '"
    If Combo1.Text = "登记日期" Then search_item = "BOOK_CHECK_DATE between #"
End If
'清理两个表格
MSHFlexGrid1.Clear
Call MSHGridset

If InStr(1, Text1, "*") > 0 Then MsgBox "通配符请用%表示": Text1.SetFocus: Exit Sub
If InStr(1, Text1, "?") > 0 Then MsgBox "通配符请用%表示": Text1.SetFocus: Exit Sub
If rds_book.State = adStateOpen Then rds_book.Close
If Combo1.Text = "出版日期" Or Combo1.Text = "登记日期" Then
    rds_book.Open "select * from 图书信息 where " & search_item & DTPicker1.Value & "# and #" & DTPicker2.Value & "#", myconn, adOpenKeyset, adLockOptimistic, 1
Else
    rds_book.Open "select * from 图书信息 where " & search_item & Text1 & "%'", myconn, adOpenKeyset, adLockOptimistic, 1
End If
Set MSHFlexGrid1.DataSource = rds_book
Call MSHGridset
MDIMain.StatusBar1.Panels(3) = "共有图书" & MSHFlexGrid1.Rows - 1 & "本满足条件"
End Sub

Private Sub Cmd_Book_clear_Click() '重置
Call renew
If rds_book.State = adStateOpen Then rds_book.Close
rds_book.Open "select * from 图书信息 ", myconn, adOpenKeyset, adLockOptimistic, 1
Set MSHFlexGrid1.DataSource = rds_book
Call MSHGridset
'rds_book.Close
MDIMain.StatusBar1.Panels(3) = "共有图书" & MSHFlexGrid1.Rows - 1 & "本满足条件"
End Sub

Private Sub Cmd_Book_print_Click() '打印
Set DR_book.DataSource = rds_book
DR_book.Show
End Sub

Private Sub Form_Activate()
Dim I As Integer
Dim rds_booksort As ADODB.Recordset
Set rds_booksort = New ADODB.Recordset
Call renew
'删除类别表
myconn.Execute "drop table 图书类别"
'无重复查找所有类别
rds_booksort.Open "SELECT DISTINCT 图书类别 INTO 图书类别 FROM 图书入库", myconn, adOpenKeyset, adLockOptimistic, 1
'将所有类别添加到新表
rds_booksort.Open "SELECT 图书类别 FROM 图书类别", myconn, adOpenKeyset, adLockOptimistic, 1
'树根
TreeView1.Nodes.Add , , "R", "所有"
'树子节点
For I = 0 To rds_booksort.RecordCount - 1
    TreeView1.Nodes.Add "R", tvwChild, "s" & I, rds_booksort.Fields(0)
    rds_booksort.MoveNext
Next I
'树自动展开
TreeView1.Nodes("R").Expanded = True
rds_booksort.Close
'查询全部图书
Call Cmd_Book_clear_Click
Call MSHGridset
MDIMain.StatusBar1.Panels(3) = "共有图书" & MSHFlexGrid1.Rows - 1 & "本满足条件"
End Sub

Private Sub Form_Resize()
Frame1.Left = (Me.ScaleWidth - Frame1.Width) / 2
Frame2.Left = (Me.ScaleWidth - Frame2.Width) / 2

End Sub

Private Sub Form_Unload(Cancel As Integer)
MDIMain.StatusBar1.Panels(3) = ""
End Sub

Private Sub MSHFlexGrid1_Click()
   If MSHFlexGrid1.Row > 0 Then Cmd_Book_del.Enabled = True
End Sub

Private Sub MSHFlexGrid1_DblClick()
If MSHFlexGrid1.Rows > 1 Then
    Dim I As Integer
    For I = 0 To 8
        If I <> 3 Then frmbook_check.txt_book(I) = MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, I)
    Next I
    frmbook_check.DTPicker1 = CDate(MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 3))
    frmbook_check.Tag = "modify"
    frmbook_check.txt_book(0).Enabled = False
    frmbook_check.Show vbModal
    Cmd_Book_clear_Click '重新查询所有
End If
End Sub





Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
Combo1.Text = "图书类别"

If Node.Text = "所有" Then
    Text1 = "%"
Else
    Text1 = Node
End If
Call Cmd_Book_search_Click
End Sub

⌨️ 快捷键说明

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