📄 添加图书信息.frm
字号:
End
Begin MSDataListLib.DataCombo DataCombo1
Bindings = "添加图书信息.frx":14F8
DataField = "booktype"
DataSource = "Adodc1"
Height = 330
Left = 1200
TabIndex = 5
Top = 1965
Width = 1335
_ExtentX = 2355
_ExtentY = 582
_Version = 393216
ForeColor = 33023
ListField = "booktype"
Text = ""
End
Begin VB.CommandButton CmdOk
Caption = "确 定"
Height = 300
Left = 2760
TabIndex = 7
Top = 1920
Width = 800
End
Begin VB.CommandButton Command2
Caption = "取 消"
Height = 300
Left = 2760
TabIndex = 8
Top = 2340
Width = 800
End
Begin VB.TextBox TxtByName
Appearance = 0 'Flat
ForeColor = &H000080FF&
Height = 270
Left = 1200
TabIndex = 2
Top = 746
Width = 1335
End
Begin VB.TextBox TxtCompany
Appearance = 0 'Flat
ForeColor = &H000080FF&
Height = 270
Left = 1200
TabIndex = 4
Top = 1575
Width = 1335
End
Begin VB.TextBox TxtByTel
Appearance = 0 'Flat
ForeColor = &H000080FF&
Height = 270
Left = 1200
TabIndex = 3
Top = 1177
Width = 1335
End
Begin VB.TextBox TxtById
Appearance = 0 'Flat
ForeColor = &H000080FF&
Height = 270
Left = 1200
TabIndex = 1
Top = 315
Width = 1335
End
Begin VB.Label Label11
AutoSize = -1 'True
Caption = "入库时间:"
Height = 180
Left = 240
TabIndex = 29
Top = 2445
Width = 900
End
Begin VB.Image Image1
Height = 780
Left = 2760
Picture = "添加图书信息.frx":150D
Top = 480
Width = 780
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "图书类型"
Height = 180
Left = 240
TabIndex = 21
Top = 2040
Width = 720
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "图书单价:"
Height = 180
Left = 240
TabIndex = 20
Top = 1200
Width = 900
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "出版社:"
Height = 180
Left = 240
TabIndex = 19
Top = 1620
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "图书名称:"
Height = 180
Left = 240
TabIndex = 18
Top = 780
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "图书编号:"
Height = 180
Left = 240
TabIndex = 17
Top = 360
Width = 900
End
End
Begin VB.Label LabId
Caption = "Label11"
Height = 375
Left = 360
TabIndex = 28
Top = 3240
Width = 1215
End
End
Attribute VB_Name = "frmAddBookInfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub CmdOk_Click()
frmBookXinXi.Adodc1.CommandType = adCmdText
frmBookXinXi.Adodc1.RecordSource = "select * from bookxinxi"
frmBookXinXi.Adodc1.Refresh
If TxtById = "" Then
MsgBox "请输图书编号", vbOKOnly + vbExclamation, "提示"
Else
Dim n%
For n = 1 To frmBookXinXi.Adodc1.Recordset.RecordCount
If Val(TxtById) = frmBookXinXi.Adodc1.Recordset.Fields("book_id") Then
MsgBox "这个编号已经有图书了,请重新输入", vbInformation, "编号重复"
Exit Sub
Else
frmBookXinXi.Adodc1.Recordset.MoveNext
End If
Next n
frmBookXinXi.Adodc1.Recordset.AddNew
frmBookXinXi.Adodc1.Recordset.Fields("book_id") = TxtById
frmBookXinXi.Adodc1.Recordset.Fields("book_name") = TxtByName
frmBookXinXi.Adodc1.Recordset.Fields("book_price") = Val(TxtByTel)
frmBookXinXi.Adodc1.Recordset.Fields("book_con") = TxtCompany
frmBookXinXi.Adodc1.Recordset.Fields("book_type") = DataCombo1.BoundText
frmBookXinXi.Adodc1.Recordset.Fields("book_date") = DTPEditTime.Value
AddorEdit = "添加"
Unload Me
End If
End Sub
Private Sub CmdOkEd_Click()
frmBookXinXi.Adodc1.Recordset.Update
frmBookXinXi.Adodc1.Recordset.Fields("book_name") = TxtByNameEd
frmBookXinXi.Adodc1.Recordset.Fields("book_price") = Val(TxtByTelEd)
frmBookXinXi.Adodc1.Recordset.Fields("book_con") = TxtCompanyEd
frmBookXinXi.Adodc1.Recordset.Fields("book_type") = DcbEditType.Text
frmBookXinXi.Adodc1.Recordset.Fields("book_date") = DTPEditTime.Value
AddorEdit = "修改"
Unload Me
End Sub
Private Sub CmdQuXiao_Click()
Call Command2_Click
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
frmAddBookInfo.Height = 3645
frmAddBookInfo.Width = 4185
frmAddBookInfo.Top = 1500
frmAddBookInfo.Left = 3800
LabByIdEd = frmBookXinXi.Adodc1.Recordset.Fields("book_id")
TxtByNameEd = frmBookXinXi.Adodc1.Recordset.Fields("book_name")
TxtByTelEd = frmBookXinXi.Adodc1.Recordset.Fields("book_price")
DcbEditType.Text = frmBookXinXi.Adodc1.Recordset.Fields("book_type")
TxtCompanyEd = frmBookXinXi.Adodc1.Recordset.Fields("book_con")
LabId = LabByIdEd
End Sub
Private Sub TxtById_KeyPress(KeyAscii As Integer)
Select Case Chr(KeyAscii)
Case "0" To "9", Chr(8), Chr(46)
Case Else
KeyAscii = 0
End Select
End Sub
Private Sub TxtByTel_KeyPress(KeyAscii As Integer)
Select Case Chr(KeyAscii)
Case "0" To "9", Chr(8), Chr(46) 'Chr(8):退格键, Chr(46):小数点
Case Else
KeyAscii = 0
End Select
End Sub
Private Sub TxtByTelEd_KeyPress(KeyAscii As Integer)
Select Case Chr(KeyAscii)
Case "0" To "9", Chr(8), Chr(46)
Case Else
KeyAscii = 0
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -