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

📄 main_jcxx_tsmlgl.frm

📁 图书综合管理系统 VB毕业设计 原代码+论文
💻 FRM
📖 第 1 页 / 共 2 页
字号:
   Begin MSComctlLib.ImageList ImageList1 
      Left            =   0
      Top             =   1410
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   16
      ImageHeight     =   16
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   5
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "main_jcxx_tsmlgl.frx":00CA
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "main_jcxx_tsmlgl.frx":051E
            Key             =   ""
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "main_jcxx_tsmlgl.frx":0972
            Key             =   ""
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "main_jcxx_tsmlgl.frx":0DC6
            Key             =   ""
         EndProperty
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "main_jcxx_tsmlgl.frx":121A
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.TreeView TreeView1 
      Height          =   4680
      Left            =   60
      TabIndex        =   0
      Top             =   390
      Width           =   3285
      _ExtentX        =   5794
      _ExtentY        =   8255
      _Version        =   393217
      LineStyle       =   1
      Style           =   7
      ImageList       =   "ImageList1"
      BorderStyle     =   1
      Appearance      =   1
   End
   Begin VB.Label Label2 
      BackStyle       =   0  'Transparent
      Caption         =   "请选择图书类别"
      Height          =   210
      Left            =   75
      TabIndex        =   20
      Top             =   135
      Width           =   1800
   End
End
Attribute VB_Name = "main_jcxx_tsmlgl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs1 As New ADODB.Recordset     '定义数据集对象
Public Sub Tree_change()     '声明树状浏览数据的过程
 Dim key, text As String
 rs1.Open "select * from tslbb order by 类别编号", Cnn, adOpenKeyset, adLockOptimistic
 If rs1.RecordCount > 0 Then
    With rs1
         .MoveFirst
         Do While .EOF = False
            If Len(.Fields("类别编号")) = 2 Then
               key = Trim(.Fields("类别名称"))
               text = "(" & Trim(.Fields("类别编号")) & ")" & Trim(.Fields("类别名称"))
               Set Node1 = TreeView1.Nodes.Add(, , , text, Val(.Fields("级别")))
               ' key
            End If
            If Len(.Fields("类别编号")) = 5 Then
               key = Trim(.Fields("类别名称"))
               text = "(" & Trim(.Fields("类别编号")) & ")" & Trim(.Fields("类别名称"))
               Set Node2 = TreeView1.Nodes.Add(Node1.Index, tvwChild, key, text, Val(.Fields("级别")))
            End If
            If Len(.Fields("类别编号")) = 9 Then
               key = Trim(.Fields("类别名称"))
               text = "(" & Trim(.Fields("类别编号")) & ")" & Trim(.Fields("类别名称"))
               Set Node3 = TreeView1.Nodes.Add(Node2.Index, tvwChild, key, text, Val(.Fields("级别")))
            End If
            If Len(.Fields("类别编号")) = 14 Then
               key = Trim(.Fields("类别名称"))
               text = "(" & Trim(.Fields("类别编号")) & ")" & Trim(.Fields("类别名称"))
               Set Node4 = TreeView1.Nodes.Add(Node3.Index, tvwChild, key, text, Val(.Fields("级别")))
            End If
            If Len(.Fields("类别编号")) = 20 Then
               key = Trim(.Fields("类别名称"))
               text = "(" & Trim(.Fields("类别编号")) & ")" & Trim(.Fields("类别名称"))
               Set Node5 = TreeView1.Nodes.Add(Node4.Index, tvwChild, key, text, Val(.Fields("级别")))
            End If
            .MoveNext
         Loop
    End With
 End If
 rs1.Close
End Sub
Private Sub Form_Load()
  Tree_change     '调用浏览数据的过程
  '设置Text1控件数组无效
  For i = 1 To 10
      Text1(i).Enabled = False
  Next i
  CmdSave.Enabled = False
End Sub
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyReturn And Index < 8 Then Text1(Index + 1).SetFocus '回车使控件获得焦点
  If KeyCode = vbKeyReturn And Index = 8 Then Text1(10).SetFocus '回车使控件获得焦点
  If KeyCode = vbKeyReturn And Index = 10 Then CmdSave.SetFocus
  If KeyCode = vbKeyUp And Index > 1 Then Text1(Index - 1).SetFocus     '按向上键使控件获得焦点
End Sub
Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
  If CmdAdd.Enabled = False Then
     Text1(9).text = TreeView1.SelectedItem.key     '赋值给Text1(9)
  Else
     '按列表中的类别查询记录,并按序号排序
     Adodc1.RecordSource = "select * from book where 类别='" + TreeView1.SelectedItem.key + "'order by 序号"
     Adodc1.Refresh
  End If
End Sub
Private Sub CmdAdd_Click()     '添加记录
 Adodc1.Recordset.AddNew     '添加记录
 '自动生成序号
 rs1.Open "select * from book order by 序号", Cnn, adOpenKeyset, adLockOptimistic
 If rs1.RecordCount > 0 Then
    If rs1.EOF = False Then rs1.MoveLast
    Text1(1).text = "B" & Format(Right(rs1.Fields("序号"), 5) + 1, "00000")
 Else
    Text1(1).text = "B00001"
 End If
 rs1.Close
 '设置Text1控件数组有效,并清空其中的数据
 For i = 2 To 10
     Text1(i).Enabled = True
 Next i
 Text1(2).SetFocus     'Text1(2)控件获得焦点
 '设置添加等按钮无效,保存按钮有效
 CmdAdd.Enabled = False
 CmdDelete.Enabled = False
 CmdModify.Enabled = False
 CmdSave.Enabled = True
End Sub
Private Sub CmdSave_Click()
 '判断是否有空项
 If Text1(2).text = "" Then
   MsgBox "【书号】不允许为空!"
   Exit Sub
 End If
 If Text1(3).text = "" Then
   MsgBox "【书名】不允许为空!"
   Exit Sub
 End If
 If Text1(4).text = "" Then
   MsgBox "【作者】不允许为空!"
   Exit Sub
 End If
 If Text1(5).text = "" Then
   MsgBox "【出版社】不允许为空!"
   Exit Sub
 End If
 If Text1(6).text = "" Then
   MsgBox "【定价】不允许为空!"
   Exit Sub
 End If
 If Text1(7).text = "" Then
   MsgBox "【出版年月】不允许为空!"
   Exit Sub
 End If
 If Text1(8).text = "" Then
   MsgBox "【册/包】不允许为空!"
   Exit Sub
 End If
 If Text1(9).text = "" Then
   MsgBox "请在左边的列表中选择【类别】!"
   Exit Sub
 End If
 Adodc1.Recordset.Update     '更新记录
 '设置控件不可用
 For i = 1 To 10
     Text1(i).Enabled = False
 Next i
 CmdSave.Enabled = False
 CmdAdd.Enabled = True
 CmdModify.Enabled = True
 CmdDelete.Enabled = True
End Sub
Private Sub CmdModify_Click()     '修改记录
 '设置Text1控件数组有效
 If Adodc1.Recordset.RecordCount > 0 Then
   For i = 1 To 10
     Text1(i).Enabled = True
   Next i
   '设置保存按钮有效,其他按钮无效
   CmdSave.Enabled = True
   CmdAdd.Enabled = False
   CmdModify.Enabled = False
   CmdDelete.Enabled = False
 Else
   MsgBox ("没有要修改的数据!")
 End If
End Sub
Private Sub CmdDelete_Click()     '删除记录
 Dim Myval As String
 With Adodc1.Recordset
 If .RecordCount > 0 Then
    Myval = MsgBox("是否要删除该记录?", vbYesNo)
    If Myval = vbYes Then
       .Delete     '删除当前记录
       .MoveNext   '将记录指针移到下一条记录
    End If
 Else
    MsgBox "没有要删除的记录!"
 End If
 End With
 '设置Text1控件数组无效
 For i = 1 To 10
     Text1(i).Enabled = False
 Next i
End Sub
Private Sub Form_Unload(Cancel As Integer)
  frm_main.Enabled = True
End Sub
Private Sub CmdExit_Click()
  Unload Me
  frm_main.Enabled = True
End Sub

⌨️ 快捷键说明

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