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

📄 lendbook.frm

📁 一个用VB写的通信录程序是一个课程设计很实用
💻 FRM
字号:
VERSION 5.00
Begin VB.Form lendbook 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "借书"
   ClientHeight    =   945
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6345
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   Picture         =   "lendbook.frx":0000
   ScaleHeight     =   945
   ScaleWidth      =   6345
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command4 
      Caption         =   "取消"
      Height          =   375
      Left            =   5280
      Picture         =   "lendbook.frx":9C09
      Style           =   1  'Graphical
      TabIndex        =   15
      Top             =   240
      Width           =   855
   End
   Begin VB.CommandButton Command3 
      Caption         =   "取消"
      Height          =   375
      Left            =   3600
      TabIndex        =   14
      Top             =   2520
      Width           =   975
   End
   Begin VB.CommandButton Command2 
      Caption         =   "借走"
      Height          =   375
      Left            =   1440
      TabIndex        =   13
      Top             =   2520
      Width           =   855
   End
   Begin VB.TextBox Text2 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      Height          =   270
      Left            =   3120
      TabIndex        =   12
      Text            =   "Text2"
      Top             =   360
      Width           =   975
   End
   Begin VB.TextBox Text1 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      Height          =   270
      Index           =   0
      Left            =   1200
      TabIndex        =   6
      Text            =   "Text1"
      Top             =   1200
      Width           =   975
   End
   Begin VB.TextBox Text1 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      Height          =   270
      Index           =   1
      Left            =   3000
      TabIndex        =   5
      Text            =   "Text1"
      Top             =   1200
      Width           =   975
   End
   Begin VB.TextBox Text1 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      Height          =   270
      Index           =   2
      Left            =   4920
      TabIndex        =   4
      Text            =   "Text1"
      Top             =   1200
      Width           =   975
   End
   Begin VB.TextBox Text1 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      Height          =   270
      Index           =   3
      Left            =   1200
      TabIndex        =   3
      Text            =   "Text1"
      Top             =   1920
      Width           =   975
   End
   Begin VB.TextBox Text1 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      Height          =   270
      Index           =   4
      Left            =   3120
      TabIndex        =   2
      Text            =   "Text1"
      Top             =   1920
      Width           =   1575
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确定"
      Height          =   375
      Left            =   4320
      Picture         =   "lendbook.frx":C469
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   240
      Width           =   855
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "出版社"
      Height          =   180
      Index           =   5
      Left            =   2520
      TabIndex        =   11
      Top             =   2040
      Width           =   540
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "类别"
      Height          =   180
      Index           =   4
      Left            =   240
      TabIndex        =   10
      Top             =   2040
      Width           =   360
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "价格"
      Height          =   180
      Index           =   3
      Left            =   4320
      TabIndex        =   9
      Top             =   1200
      Width           =   360
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "书名"
      Height          =   180
      Index           =   2
      Left            =   2520
      TabIndex        =   8
      Top             =   1200
      Width           =   360
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "图书编号"
      Height          =   180
      Index           =   0
      Left            =   240
      TabIndex        =   7
      Top             =   1200
      Width           =   720
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "输入你要借的图书编号"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   240
      Index           =   1
      Left            =   120
      TabIndex        =   0
      Top             =   360
      Width           =   2565
   End
End
Attribute VB_Name = "lendbook"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim sql As String
Dim i As Integer
Dim j As Integer

Command2.Enabled = False
sql = "select * from book where bookno='" & Trim(Text2.Text) & "'"
opendb sql, ""
If rs.EOF Then
    MsgBox "没有这本书", 64, "提示"
    Text2.Text = ""
    Text2.SetFocus
    closedb
    Exit Sub
ElseIf rs("stock") = 0 Or rs("stock") < 0 Then
    MsgBox "这本书已经被借完了。", 64, "提示"
    Command4.Visible = False
    If Not lendbook.Height = 3920 Then
        lendbook.Height = lendbook.Height + 2600
    End If
    For i = 0 To rs.Fields.Count - 4
        Text1(i).Text = rs(i + 1).Value & " "
    Next
Else
    Command2.Enabled = True
    Command4.Visible = False
    lendbookno = Trim(Text2.Text)
    If Not lendbook.Height = 3920 Then
        lendbook.Height = lendbook.Height + 2600
    End If
    For j = 0 To rs.Fields.Count - 4
        Text1(j).Text = rs(j + 1).Value & " "
    Next
End If
closedb

End Sub

Private Sub Command2_Click()
Dim sql As String
Dim i As Integer
Dim j As Integer
sql = "select * from book where bookno='" & lendbookno & "'"
opendb sql, "2"
rs("stock") = Val(rs("stock")) - 1 '借出一本将库存减一
rs.Update
closedb

sql = "select * from lendbook"
opendb sql, "2"
rs.AddNew
rs("username") = username '添加一条借书信息
rs("name") = name1
rs("bookno") = Trim(Text1(0).Text)
rs("booktitle") = Trim(Text1(1).Text)
rs("price") = Val(Trim(Text1(2).Text))
rs("sort") = Trim(Text1(3).Text)
rs("press") = Trim(Text1(4).Text)
rs("lenddate") = Date
If setflag = False Then
    rs("backdate") = Date + 30
Else
    rs("backdate") = Date + bookday
End If
rs.Update
closedb
MsgBox "你成功借了《" & Trim(Text1(1).Text) & "》这本书", 64, "提示"
Unload Me
End Sub

Private Sub Command3_Click()
Unload Me
End Sub

Private Sub Command4_Click()
Unload Me
End Sub

Private Sub Form_Activate()
Text2.SetFocus
End Sub

Private Sub Form_Load()
Text2.Text = ""
For i = 0 To 4
    Text1(i).Text = ""
    Text1(i).Locked = True
Next
End Sub

⌨️ 快捷键说明

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