📄 frmbookleibie.frm
字号:
VERSION 5.00
Begin VB.Form frmBookleibie
BackColor = &H80000013&
Caption = "Form1"
ClientHeight = 2895
ClientLeft = 5370
ClientTop = 5430
ClientWidth = 4125
LinkTopic = "Form1"
ScaleHeight = 2895
ScaleWidth = 4125
Begin VB.TextBox txt_leibie
Height = 375
Left = 1200
TabIndex = 5
Top = 1200
Width = 2055
End
Begin VB.CommandButton cmdExit
Caption = "取消"
Height = 375
Left = 2160
TabIndex = 4
Top = 2040
Width = 855
End
Begin VB.CommandButton cmdAdd
Caption = "添加"
Height = 375
Left = 960
TabIndex = 3
Top = 2040
Width = 855
End
Begin VB.ComboBox lbmc
Height = 300
Left = 1200
TabIndex = 2
Text = "图书类别列表"
Top = 1200
Width = 2055
End
Begin VB.Label Label2
AutoSize = -1 'True
BackColor = &H80000013&
Caption = "类别列表:"
Height = 180
Left = 240
TabIndex = 1
Top = 1320
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H80000013&
Caption = "图书类别"
BeginProperty Font
Name = "隶书"
Size = 21.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 435
Left = 1080
TabIndex = 0
Top = 240
Width = 1800
End
End
Attribute VB_Name = "frmBookleibie"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdAdd_Click()
Dim sql As String
Label1.Caption = "添加图书类别"
Label2.Caption = "类别名称"
txt_leibie.Visible = True
lbmc.Visible = False
sql = "select * from book_category where lbmc ='" & txt_leibie.Text & "'"
If txt_leibie.Text = "" Then
MsgBox "填写类别名称"
txt_leibie.SetFocus
Exit Sub
Else
Set rs = ADOSQL(sql)
If rs.EOF = False Then
MsgBox "该图书类别已经存在,请核对!", vbOKOnly
rs.Close
Else
Set rs = ADOSQL(sql)
rs.AddNew '添加新纪录
rs.Fields(1) = Trim(txt_leibie.Text)
rs.Update
MsgBox "添加成功"
Unload Me
End If
End If
End Sub
Private Sub Form_Load()
'添加类别名称
lbmc.Visible = True
txt_leibie.Visible = False
sql_lb = "select lbmc from book_category"
Set rs_lb = ADOSQL(sql_lb)
While Not rs_lb.EOF
lbmc.AddItem rs_lb(0)
rs_lb.MoveNext
Wend
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -