📄 main_jcxx_tswzsz.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form main_jcxx_tswzsz
BorderStyle = 3 'Fixed Dialog
Caption = "基础信息管理-【图书存放位置】"
ClientHeight = 3630
ClientLeft = 45
ClientTop = 330
ClientWidth = 6540
Icon = "main_jcxx_tswzsz.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3630
ScaleWidth = 6540
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "main_jcxx_tswzsz.frx":0442
Height = 1395
Left = 75
TabIndex = 12
Top = 2190
Width = 6420
_ExtentX = 11324
_ExtentY = 2461
_Version = 393216
HeadLines = 1
RowHeight = 15
FormatLocked = -1 'True
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = "位置编号"
Caption = "位置编号"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = "存放位置"
Caption = "存放位置"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
ColumnWidth = 2580.095
EndProperty
BeginProperty Column01
ColumnWidth = 2745.071
EndProperty
EndProperty
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 165
Top = 3180
Width = 1575
_ExtentX = 2778
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 3
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "DSN=NBooks"
OLEDBString = ""
OLEDBFile = ""
DataSourceName = "NBooks"
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select * from tswzb"
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Frame Frame1
Caption = "图书存放位置信息"
Height = 1455
Left = 75
TabIndex = 0
Top = 45
Width = 6420
Begin VB.TextBox Text2
Enabled = 0 'False
Height = 285
Left = 2295
TabIndex = 2
Top = 930
Width = 3735
End
Begin VB.TextBox Text1
BackColor = &H00FFFFFF&
Enabled = 0 'False
Height = 285
Left = 2295
Locked = -1 'True
TabIndex = 1
Top = 405
Width = 2220
End
Begin VB.Image Image1
Height = 810
Left = 300
Picture = "main_jcxx_tswzsz.frx":0457
Stretch = -1 'True
Top = 330
Width = 765
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "位置编号: 存放位置:"
ForeColor = &H000000FF&
Height = 885
Left = 1350
TabIndex = 4
Top = 465
Width = 990
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Height = 240
Left = 135
TabIndex = 3
Top = 435
Width = 930
End
End
Begin VB.Frame Frame2
Height = 675
Left = 75
TabIndex = 5
Top = 1470
Width = 4875
Begin VB.CommandButton CmdAdd
Caption = "添加"
Height = 360
Left = 75
TabIndex = 9
Top = 210
Width = 1095
End
Begin VB.CommandButton CmdDelete
Caption = "删除"
Height = 360
Left = 2475
TabIndex = 8
Top = 210
Width = 1095
End
Begin VB.CommandButton CmdSave
Caption = "保存"
Enabled = 0 'False
Height = 360
Left = 1275
TabIndex = 7
Top = 210
Width = 1095
End
Begin VB.CommandButton CmdEsc
Caption = "取消"
Enabled = 0 'False
Height = 360
Left = 3675
TabIndex = 6
Top = 210
Width = 1095
End
End
Begin VB.Frame Frame3
Height = 675
Left = 4920
TabIndex = 10
Top = 1470
Width = 1575
Begin VB.CommandButton CmdExit
Caption = "退出"
Height = 360
Left = 240
TabIndex = 11
Top = 210
Width = 1095
End
End
End
Attribute VB_Name = "main_jcxx_tswzsz"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs1 As New ADODB.Recordset '声明数据集对象
Private Sub Text1_GotFocus() '获得焦点时,Text1颜色变化
Text1.BackColor = &HFFFF00
End Sub
Private Sub Text1_LostFocus() '失去焦点时,Text1颜色变化
Text1.BackColor = &HFFFFFF
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text2.SetFocus
End Sub
Private Sub Text2_GotFocus()
Text2.BackColor = &HFFFF00
End Sub
Private Sub Text2_LostFocus()
Text2.BackColor = &HFFFFFF
End Sub
Private Sub CmdAdd_Click() '添加操作
'自动创建位置编号
rs1.Open "select * from tswzb order by 位置编号", Cnn, adOpenKeyset, adLockOptimistic
If rs1.RecordCount > 0 Then
If Not rs1.EOF Then rs1.MoveLast
If rs1.Fields("位置编号") <> "" Then
Text1.text = "P" & Format(Right(rs1.Fields("位置编号"), 5) + 1, "00000")
End If
Else
Text1.text = "P00001"
End If
rs1.Close
Text1.Enabled = True
Text2.Enabled = True
Text2.SetFocus
'设置控件状态
CmdAdd.Enabled = False
CmdDelete.Enabled = False
CmdSave.Enabled = True
CmdEsc.Enabled = True
End Sub
Private Sub CmdSave_Click() '保存图书存放位置信息
rs1.Open "select * from tswzb where 位置编号='" & Trim(Text1.text) & "'order by 位置编号", Cnn, adOpenKeyset, adLockOptimistic
If Text2.text = "" Then
MsgBox ("请输入存放位置!")
Text2.SetFocus
Exit Sub
End If
'添加图书存放位置信息
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("位置编号") = Text1.text
Adodc1.Recordset.Fields("存放位置") = Text2.text
'更新数据库
Adodc1.Recordset.Update
'清空文本框中的数据
Text1.text = ""
Text2.text = ""
'设置控件有效或无效
Text1.Enabled = False
Text2.Enabled = False
CmdSave.Enabled = False
CmdEsc.Enabled = False
CmdAdd.Enabled = True
CmdDelete.Enabled = True
rs1.Close
End Sub
Private Sub CmdDelete_Click() '删除图书存放位置信息
On Error Resume Next
Adodc1.Recordset.Delete
Adodc1.Recordset.Update
End Sub
Private Sub CmdEsc_Click() '取消操作
'设置控件状态
Text1.text = ""
Text2.text = ""
Text1.Enabled = False
Text2.Enabled = False
CmdSave.Enabled = False
CmdEsc.Enabled = False
CmdAdd.Enabled = True
CmdDelete.Enabled = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
frm_main.Enabled = True
End Sub
Private Sub CmdExit_Click()
Unload Me
frm_main.Enabled = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -