📄 frmsrchbookinfo.frm
字号:
VERSION 5.00
Begin VB.Form frmSrchBookInfo
Caption = "图书信息查找"
ClientHeight = 5625
ClientLeft = 60
ClientTop = 345
ClientWidth = 7035
Icon = "frmSrchBookInfo.frx":0000
LinkTopic = "Form1"
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 5625
ScaleWidth = 7035
WindowState = 2 'Maximized
Begin VB.TextBox txtBookName
BorderStyle = 0 'None
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3120
Locked = -1 'True
TabIndex = 6
TabStop = 0 'False
Top = 1560
Width = 2535
End
Begin VB.Frame Frame1
Caption = "输入图书信息并回车"
ForeColor = &H00FF0000&
Height = 735
Left = 480
TabIndex = 0
Top = 600
Width = 6375
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 4920
TabIndex = 12
Top = 240
Width = 975
End
Begin VB.TextBox txtBookId
BackColor = &H0080FFFF&
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 375
Left = 2160
TabIndex = 2
Top = 240
Width = 2415
End
Begin VB.Label lblBookId
AutoSize = -1 'True
Caption = "书号"
BeginProperty Font
Name = "Times New Roman"
Size = 14.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 240
TabIndex = 1
Top = 240
Width = 630
End
End
Begin VB.TextBox txtPubId
BorderStyle = 0 'None
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3120
Locked = -1 'True
TabIndex = 5
TabStop = 0 'False
Top = 2760
Width = 2535
End
Begin VB.TextBox txtCatId
BorderStyle = 0 'None
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3120
Locked = -1 'True
TabIndex = 4
TabStop = 0 'False
Top = 3360
Width = 2535
End
Begin VB.TextBox txtAuthor
BorderStyle = 0 'None
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3120
Locked = -1 'True
TabIndex = 3
TabStop = 0 'False
Top = 2160
Width = 2535
End
Begin VB.Label lblBookName
AutoSize = -1 'True
Caption = "书名"
BeginProperty Font
Name = "Times New Roman"
Size = 14.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 720
TabIndex = 11
Top = 1560
Width = 630
End
Begin VB.Label lblPubId
AutoSize = -1 'True
Caption = "出版物号"
BeginProperty Font
Name = "Times New Roman"
Size = 14.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 720
TabIndex = 10
Top = 2760
Width = 1260
End
Begin VB.Label lblCatId
AutoSize = -1 'True
Caption = "类别号"
BeginProperty Font
Name = "Times New Roman"
Size = 14.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 720
TabIndex = 9
Top = 3360
Width = 945
End
Begin VB.Label lblInfo
Alignment = 2 'Center
BackColor = &H00000080&
Caption = "图书信息查找"
BeginProperty Font
Name = "Times New Roman"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 375
Left = 0
TabIndex = 8
Top = 0
Width = 5775
End
Begin VB.Label lblAuthor
AutoSize = -1 'True
Caption = "作者"
BeginProperty Font
Name = "Times New Roman"
Size = 14.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 720
TabIndex = 7
Top = 2160
Width = 630
End
End
Attribute VB_Name = "frmSrchBookInfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim BookNo As String
'assigning Srch value
BookNo = txtBookId.Text
'If enter is pressed by user than auto-generate record
clear
'Prompt if invalid search key is entered by user
If Not IsNumeric(BookNo) Then
MsgBox "输入错误", vbCritical, "查找错误"
Call clear
Exit Sub
End If
rsBookInfo.MoveFirst
For i = 0 To rsBookInfo.RecordCount
If rsBookInfo.EOF = True Then
Exit For
End If
If rsBookInfo(0) = Val(Trim$(BookNo)) Then
txtBookName.Text = rsBookInfo(1)
txtAuthor.Text = rsBookInfo(2)
txtPubId.Text = rsBookInfo(3)
txtCatId.Text = rsBookInfo(4)
Exit For
End If
rsBookInfo.MoveNext
Next
If txtBookName.Text = "" Then
MsgBox "无此书!", vbInformation, "查找结果"
'cmdSave.Enabled = False
clear
End If
End Sub
Private Sub Form_Load()
'Setting up the info. label
lblInfo.Left = Me.ScaleLeft
lblInfo.Top = Me.ScaleTop
lblInfo.Width = Screen.Width
End Sub
Private Sub Form_Activate()
clear
End Sub
Private Sub cmdBookOpen_Click()
frmBookInfo.Show
frmBookInfo.SetFocus
End Sub
'========================================================
'Database Related Code...!!!
'========================================================
'Supporting Function
'Simple clearing of textBox
Private Sub clear()
txtBookId.Text = ""
txtBookName.Text = ""
txtAuthor.Text = ""
txtPubId.Text = ""
txtCatId.Text = ""
txtBookId.SetFocus
End Sub
Private Sub Txtbookid_KeyPress(KeyAscii As Integer)
Dim BookNo As String
'assigning Srch value
BookNo = txtBookId.Text
'If enter is pressed by user than auto-generate record
If KeyAscii = 13 Then
clear
'Prompt if invalid search key is entered by user
If Not IsNumeric(BookNo) Then
MsgBox "输入错误", vbCritical, "查找错误"
Call clear
Exit Sub
End If
rsBookInfo.MoveFirst
For i = 0 To rsBookInfo.RecordCount
If rsBookInfo.EOF = True Then
Exit For
End If
If rsBookInfo(0) = Val(Trim$(BookNo)) Then
txtBookName.Text = rsBookInfo(1)
txtAuthor.Text = rsBookInfo(2)
txtPubId.Text = rsBookInfo(3)
txtCatId.Text = rsBookInfo(4)
Exit For
End If
rsBookInfo.MoveNext
Next
If txtBookName.Text = "" Then
MsgBox "无此书!", vbInformation, "查找结果"
'cmdSave.Enabled = False
clear
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -