📄 frmbookinfo.frm
字号:
End
Begin VB.Label Label5
Caption = "图书类别号:"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 375
Left = 4560
TabIndex = 14
Top = 2880
Width = 1695
End
Begin VB.Label Label4
Caption = "出版社:"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 375
Left = 4560
TabIndex = 11
Top = 960
Width = 1215
End
Begin VB.Label Label3
Caption = "出版日期:"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 375
Left = 480
TabIndex = 10
Top = 2880
Width = 1455
End
Begin VB.Label Label2
Caption = "作者:"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 375
Left = 480
TabIndex = 7
Top = 1800
Width = 855
End
Begin VB.Label Label1
Caption = "书名:"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 375
Left = 480
TabIndex = 6
Top = 960
Width = 855
End
End
Begin MSComctlLib.TabStrip TabStrip1
Height = 5895
Left = 240
TabIndex = 0
Top = 120
Width = 10335
_ExtentX = 18230
_ExtentY = 10398
_Version = 393216
BeginProperty Tabs {1EFB6598-857C-11D1-B16A-00C0F0283628}
NumTabs = 2
BeginProperty Tab1 {1EFB659A-857C-11D1-B16A-00C0F0283628}
Caption = "添加"
Key = "Type_Add"
ImageVarType = 2
EndProperty
BeginProperty Tab2 {1EFB659A-857C-11D1-B16A-00C0F0283628}
Caption = "查询"
Key = "Type_Query"
ImageVarType = 2
EndProperty
EndProperty
End
End
Attribute VB_Name = "FrmBookInfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'添加图书信息
Private Sub CmdAddOk_Click()
Dim str As String
'检查输入
If Len(Trim(Me.TextBkName.Text)) <= 0 Then
MsgBox "请输入书名!"
Exit Sub
ElseIf Len(Trim(Me.TextBkName.Text)) > 20 Then
MsgBox "您输入的书名过长!"
Exit Sub
End If
If Len(Trim(Me.TextBkAuthor.Text)) <= 0 Then
MsgBox "请输入作者!"
Exit Sub
ElseIf Len(Trim(Me.TextBkAuthor.Text)) > 20 Then
MsgBox "您输入的作者名过长!"
Exit Sub
End If
If Len(Trim(Me.TextBkPress.Text)) <= 0 Then
MsgBox "请输入出版社!"
Exit Sub
ElseIf Len(Trim(Me.TextBkPress.Text)) > 20 Then
MsgBox "您输入的出版社名过长!"
Exit Sub
End If
If Len(Trim(Me.TextPrsNum.Text)) <= 0 Then
MsgBox "请输入版本号!"
Exit Sub
ElseIf Val(Me.TextPrsNum.Text) > 10 Then
MsgBox "您输入的版本号过长!"
Exit Sub
ElseIf Val(Me.TextPrsNum.Text) = 0 Then
MsgBox "版本号必须为整数且不能为0!"
Exit Sub
End If
If Len(Trim(Me.TextBkType.Text)) <= 0 Then
MsgBox "请输入图书类型号!"
Exit Sub
ElseIf Val(Me.TextBkType.Text) = 0 Or Val(Me.TextBkType.Text) > 99 Then
str = "您输入的图书类型号过长!"
str = str & vbCrLf & "图书类型号必须是整数且不为0!"
MsgBox str
Exit Sub
End If
'生成发送数据=Book,01,Bk_Name,Bk_Author,Bk_Press,
' Book_PrsNum, Bk_PrsDate,Bk_Type
str = "Book,01,"
str = str & Me.TextBkName.Text & ","
str = str & Me.TextBkAuthor.Text & ","
str = str & Me.TextBkPress.Text & ","
str = str & Me.TextPrsNum.Text & ","
str = str & Me.DTPicker1.Value & ","
str = str & Val(Me.TextBkType.Text)
'检验sock连接
If MDIFrm.SockToSvr.State <> sckConnected Then
MsgBox "还没有连接数据库,不能发送请求!"
Exit Sub
End If
'向服务器发送数据
MDIFrm.SockToSvr.SendData str
End Sub
Private Sub CmdCancel_Click() '取消
Unload Me
End Sub
'查询图书信息
Private Sub CmdQuery_Click()
Dim str As String
'首先清空列表
Me.LvBkResult.ListItems.Clear
'检验输入
If Me.Option1.Value = True Then
If Len(Trim(Me.TextQueryName.Text)) <= 0 Then
MsgBox "请输入书名!"
Exit Sub
ElseIf Len(Trim(Me.TextQueryName.Text)) > 20 Then
MsgBox "您输入的书名过长!"
Exit Sub
End If
'生成要发送的数据 = Book,02,Bk_Name
str = "Book," & "02," & Me.TextQueryName.Text
'检验sock连接
If MDIFrm.SockToSvr.State <> sckConnected Then
MsgBox "还没有连接数据库,不能发送请求!"
Exit Sub
End If
'向服务器发送数据
MDIFrm.SockToSvr.SendData str
ElseIf Me.Option2.Value = True Then
'检验输入内容
If Len(Trim(Me.TextQueryAth.Text)) <= 0 Then
MsgBox "请输入作者!"
Exit Sub
ElseIf Len(Trim(Me.TextQueryAth.Text)) > 4 Then
MsgBox "您输入的作者名过长!"
Exit Sub
End If
'生成要发送的数据 = Book,03,Bk_Author
str = "Book," & "03," & Me.TextQueryAth.Text
'检验sock连接
If MDIFrm.SockToSvr.State <> sckConnected Then
MsgBox "还没有连接数据库,不能发送请求!"
Exit Sub
End If
'向服务器发送数据
MDIFrm.SockToSvr.SendData str
End If
End Sub
'查看已有图书类别
Private Sub CmdQueryType_Click()
Dim str As String
FrmBookType.Show
FrmBookType.FrameAdd.Visible = False
FrmBookType.FrameQuery.Visible = True
'生成要发送的数据 = Type,02
str = "Type," & "02"
'检验sock连接并向服务器发送数据
If MDIFrm.SockToSvr.State <> sckConnected Then
MsgBox "还没有连接数据库,不能发送请求!"
Exit Sub
End If
MDIFrm.SockToSvr.SendData str
End Sub
Private Sub Form_Load()
Me.LvBkResult.ColumnHeaders(1).Width = Me.LvBkResult.Width / 12
Me.LvBkResult.ColumnHeaders(2).Width = Me.LvBkResult.Width * 11 / 12
Me.FrameAdd.Visible = True
Me.FrameQuery.Visible = False
End Sub
'选择查询类型
Private Sub Option1_Click()
Me.TextQueryAth.Text = ""
End Sub
Private Sub Option2_Click()
Me.TextQueryName.Text = ""
End Sub
'选项卡切换
Private Sub TabStrip1_Click()
Select Case TabStrip1.SelectedItem.Key
Case "Type_Add"
Me.FrameAdd.Visible = True
Me.FrameQuery.Visible = False
Case "Type_Query"
Me.FrameAdd.Visible = False
Me.FrameQuery.Visible = True
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -