📄 frmeditberth.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form EditBerth
BorderStyle = 1 'Fixed Single
Caption = "车位数据管理"
ClientHeight = 2205
ClientLeft = 45
ClientTop = 330
ClientWidth = 4785
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 2205
ScaleWidth = 4785
Begin VB.ComboBox cmbType
DataField = "类型"
DataSource = "Adodc1"
Height = 300
ItemData = "frmEditBerth.frx":0000
Left = 1320
List = "frmEditBerth.frx":0002
TabIndex = 1
Top = 630
Width = 1815
End
Begin VB.CommandButton cmdNew
Caption = "添加"
Height = 300
Left = 3360
TabIndex = 3
Top = 240
Width = 735
End
Begin VB.CommandButton cmdDelete
Caption = "删除"
Height = 300
Left = 3360
TabIndex = 4
Top = 558
Width = 735
End
Begin VB.CommandButton cmdRefresh
Caption = "刷新"
Height = 300
Left = 3360
TabIndex = 6
Top = 1194
Width = 735
End
Begin VB.CommandButton cmdSave
Caption = "保存"
Height = 300
Left = 3360
TabIndex = 5
Top = 876
Width = 735
End
Begin VB.CommandButton cmdExit
Caption = "关闭"
Height = 300
Left = 3360
TabIndex = 7
Top = 1515
Width = 735
End
Begin VB.TextBox txtNumber
DataField = "车位号"
DataSource = "Adodc1"
Height = 270
Left = 1320
Locked = -1 'True
TabIndex = 0
Top = 255
Width = 1815
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 600
Top = 1440
Width = 2775
_ExtentX = 4895
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 3
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "DSN=物管数据DSN"
OLEDBString = ""
OLEDBFile = ""
DataSourceName = "物管数据DSN"
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "车场数据"
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.TextBox txtPrice
DataField = "单价"
DataSource = "Adodc1"
Height = 270
Left = 1320
MaxLength = 4
TabIndex = 2
Top = 1035
Width = 1815
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "车位号"
Height = 180
Left = 720
TabIndex = 10
Top = 300
Width = 540
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "类 型"
Height = 180
Left = 720
TabIndex = 9
Top = 690
Width = 540
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "单 价"
Height = 180
Left = 720
TabIndex = 8
Top = 1080
Width = 540
End
End
Attribute VB_Name = "EditBerth"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Adodc1_MoveComplete(ByVal adReason As EventReasonEnum, _
ByVal pError As Error, adStatus As EventStatusEnum, ByVal pRecordset As Recordset)
With Adodc1.Recordset
If .AbsolutePosition > 0 Then
Adodc1.Caption = "当前记录:" & .AbsolutePosition & "/" & .RecordCount
Else
Adodc1.Caption = "无车位数据"
End If
End With
End Sub
Private Sub cmdDelete_Click()
With Adodc1.Recordset
If Not .EOF Then
If MsgBox("将删除" & txtNumber & "车位数据,是否继续?", _
vbCritical + vbYesNo, "车位数据管理") = vbYes Then
.Delete
.MoveNext
If .EOF And .RecordCount > 0 Then .MoveLast
End If
End If
End With
End Sub
Private Sub cmdNew_Click()
Adodc1.Recordset.AddNew '添加新记录
cmbType.ListIndex = 0 '设置默认类型
cmdNew.Enabled = False '禁用控件
cmdDelete.Enabled = False
Adodc1.Enabled = False
End Sub
Private Sub cmdRefresh_Click()
Adodc1.Refresh '刷新数据
cmdNew.Enabled = True '启用控件
cmdDelete.Enabled = True
Adodc1.Enabled = True
End Sub
Private Sub cmdSave_Click()
If txtNumber = "" Then
MsgBox "车位号不能为空!", vbCritical, "车位数据管理"
txtNumber.SetFocus
ElseIf cmbType.Text = "" Then
MsgBox "类型不能为空!", vbCritical, "车位数据管理"
cmbType.SetFocus
ElseIf txtPrice = "" Then
MsgBox "单价不能为空!", vbCritical, "车位数据管理"
txtPrice.SetFocus
Else
Adodc1.Recordset.Update
MsgBox "车位数据保存成功!", vbInformation, "车位数据管理"
cmdNew.Enabled = True
cmdDelete.Enabled = True
Adodc1.Enabled = True
End If
End Sub
Private Sub Form_Load()
cmbType.AddItem ("大") '添加车位类型列表,并设置该类型的停车单价
cmbType.ItemData(cmbType.NewIndex) = 500
cmbType.AddItem ("中")
cmbType.ItemData(cmbType.NewIndex) = 300
cmbType.AddItem ("小")
cmbType.ItemData(cmbType.NewIndex) = 200
End Sub
Private Sub cmdExit_Click()
Unload Me '关闭车位数据管理窗体
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -