📄 frmdeletebook.frm
字号:
VERSION 5.00
Begin VB.Form frmDeleteBook
Caption = "删除图书"
ClientHeight = 4140
ClientLeft = 60
ClientTop = 345
ClientWidth = 6870
LinkTopic = "Form1"
ScaleHeight = 4140
ScaleWidth = 6870
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Command1
Caption = "返回(&C)"
Height = 495
Left = 3600
TabIndex = 19
Top = 3360
Width = 1695
End
Begin VB.CommandButton cmdDelete
Caption = "删除(&D)"
Height = 495
Left = 1560
TabIndex = 18
Top = 3360
Width = 1815
End
Begin VB.Frame Frame2
Height = 735
Left = 360
TabIndex = 13
Top = 2400
Width = 6135
Begin VB.CommandButton cmdLast
Caption = "最后一条"
Height = 375
Left = 4680
TabIndex = 17
Top = 240
Width = 1095
End
Begin VB.CommandButton cmdFirst
Caption = "第一条"
Height = 375
Left = 360
TabIndex = 16
Top = 240
Width = 1095
End
Begin VB.CommandButton cmdNext
Caption = "下一条"
Height = 375
Left = 3240
TabIndex = 15
Top = 240
Width = 1095
End
Begin VB.CommandButton cmdBefore
Caption = "上一条"
Height = 375
Left = 1800
TabIndex = 14
Top = 240
Width = 1095
End
End
Begin VB.Frame Frame1
Caption = "图书记录信息"
Height = 2055
Left = 360
TabIndex = 0
Top = 360
Width = 6135
Begin VB.TextBox txtName
Height = 375
Left = 840
TabIndex = 6
Text = "Text1"
Top = 840
Width = 1455
End
Begin VB.TextBox txtPrice
Height = 375
Left = 840
TabIndex = 5
Text = "Text2"
Top = 1320
Width = 1455
End
Begin VB.TextBox txtPub
Height = 375
Left = 3480
TabIndex = 4
Text = "Text3"
Top = 840
Width = 2415
End
Begin VB.TextBox txtISBN
Height = 375
Left = 3480
TabIndex = 3
Text = "Text4"
Top = 1320
Width = 2415
End
Begin VB.ComboBox cmbType
Height = 315
Left = 3480
TabIndex = 2
Text = "Combo1"
Top = 360
Width = 2415
End
Begin VB.TextBox txtId
Height = 375
Left = 840
TabIndex = 1
Text = "Text5"
Top = 360
Width = 1455
End
Begin VB.Label Label1
Caption = "书 名:"
Height = 255
Left = 120
TabIndex = 12
Top = 960
Width = 735
End
Begin VB.Label Label2
Caption = "出版社:"
Height = 375
Left = 2760
TabIndex = 11
Top = 960
Width = 855
End
Begin VB.Label Label3
Caption = "价 格:"
Height = 255
Left = 120
TabIndex = 10
Top = 1440
Width = 735
End
Begin VB.Label Label4
Caption = " ISBN:"
Height = 255
Left = 2760
TabIndex = 9
Top = 1440
Width = 735
End
Begin VB.Label Label5
Caption = "图书类别:"
Height = 375
Left = 2640
TabIndex = 8
Top = 480
Width = 975
End
Begin VB.Label Label6
Caption = "编 号:"
Height = 375
Left = 120
TabIndex = 7
Top = 480
Width = 855
End
End
End
Attribute VB_Name = "frmDeleteBook"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim dbBook As Database
Dim rsBook As Recordset
Private Sub cmdBefore_Click()
rsBook.MovePrevious
If rsBook.BOF Then rsBook.MoveFirst
showRec
End Sub
Private Sub cmdDelete_Click()
Dim sel As Integer
sel = MsgBox("确定要删除吗?", vbOKCancel, "确认")
If sel = vbOK Then
rsBook.Delete
cmdNext_Click
MsgBox "成功删除一条记录", vbInformation, "提示"
End If
End Sub
Private Sub cmdFirst_Click()
rsBook.MoveFirst
showRec
End Sub
Private Sub cmdLast_Click()
rsBook.MoveLast
showRec
End Sub
Private Sub cmdNext_Click()
rsBook.MoveNext
If rsBook.EOF Then rsBook.MoveLast
showRec
End Sub
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Form_Load()
Set dbBook = OpenDatabase(".\db\library.mdb", False)
Set rsBook = dbBook.OpenRecordset("book", dbOpenTable)
rsBook.Index = "bookid"
'显示当前的数据记录
showRec
End Sub
Public Sub showRec()
'将当前记录位置的数据在窗体中显示出来
Dim isbn As String
txtId.Text = rsBook.Fields("bookid")
txtName.Text = rsBook.Fields("bookname")
txtPrice.Text = rsBook.Fields("bookprice")
txtISBN.Text = rsBook.Fields("ISBN")
txtPub.Text = rsBook.Fields("publisher")
cmbType.Text = rsBook.Fields("bookType")
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -