📄 frmroomtypeman.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 FrmRoomTypeMan
BorderStyle = 1 'Fixed Single
Caption = "客房类型管理"
ClientHeight = 3480
ClientLeft = 45
ClientTop = 330
ClientWidth = 8400
Icon = "FrmRoomTypeMan.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3480
ScaleWidth = 8400
StartUpPosition = 2 'CenterScreen
Begin VB.Frame Frame4
Caption = "电视"
Height = 735
Left = 4800
TabIndex = 18
Top = 960
Width = 1695
Begin VB.OptionButton Option5
Caption = "有"
Height = 375
Left = 240
TabIndex = 20
Top = 240
Width = 495
End
Begin VB.OptionButton Option6
Caption = "无"
Height = 375
Left = 960
TabIndex = 19
Top = 240
Width = 495
End
End
Begin VB.Frame Frame3
Caption = "电话"
Height = 735
Left = 6600
TabIndex = 15
Top = 120
Width = 1695
Begin VB.OptionButton Option3
Caption = "有"
Height = 375
Left = 240
TabIndex = 17
Top = 240
Width = 495
End
Begin VB.OptionButton Option4
Caption = "无"
Height = 375
Left = 960
TabIndex = 16
Top = 240
Width = 495
End
End
Begin VB.Frame Frame5
Caption = "独立卫生间"
Height = 735
Left = 6600
TabIndex = 12
Top = 960
Width = 1695
Begin VB.OptionButton Option7
Caption = "有"
Height = 375
Left = 240
TabIndex = 14
Top = 240
Width = 495
End
Begin VB.OptionButton Option8
Caption = "无"
Height = 375
Left = 960
TabIndex = 13
Top = 240
Width = 495
End
End
Begin VB.Frame Frame6
Caption = "冰箱"
Height = 735
Left = 4800
TabIndex = 9
Top = 1800
Width = 1695
Begin VB.OptionButton Option9
Caption = "有"
Height = 375
Left = 240
TabIndex = 11
Top = 240
Width = 495
End
Begin VB.OptionButton Option10
Caption = "无"
Height = 375
Left = 960
TabIndex = 10
Top = 240
Width = 495
End
End
Begin VB.CommandButton Cmd_Add
Caption = "添 加"
Height = 495
Left = 833
MouseIcon = "FrmRoomTypeMan.frx":0CCA
MousePointer = 99 'Custom
TabIndex = 6
Top = 2760
Width = 1215
End
Begin VB.CommandButton Cmd_Modi
Caption = "修 改"
Height = 495
Left = 2678
MouseIcon = "FrmRoomTypeMan.frx":0FD4
MousePointer = 99 'Custom
TabIndex = 5
Top = 2760
Width = 1215
End
Begin VB.CommandButton Cmd_Del
Caption = "删 除"
Height = 495
Left = 4508
MouseIcon = "FrmRoomTypeMan.frx":12DE
MousePointer = 99 'Custom
TabIndex = 4
Top = 2760
Width = 1215
End
Begin VB.CommandButton Cmd_Close
Caption = "关 闭"
Height = 495
Left = 6353
MouseIcon = "FrmRoomTypeMan.frx":15E8
MousePointer = 99 'Custom
TabIndex = 3
Top = 2760
Width = 1215
End
Begin VB.Frame Frame2
Caption = "空调"
Height = 735
Left = 4800
TabIndex = 2
Top = 120
Width = 1695
Begin VB.OptionButton Option2
Caption = "无"
Height = 375
Left = 960
TabIndex = 8
Top = 263
Width = 495
End
Begin VB.OptionButton Option1
Caption = "有"
Height = 375
Left = 240
TabIndex = 7
Top = 240
Width = 495
End
End
Begin VB.Frame Frame1
Caption = "客房类型列表"
Height = 2415
Left = 120
TabIndex = 0
Top = 120
Width = 4575
Begin MSDataGridLib.DataGrid DataGrid1
Height = 2055
Left = 120
TabIndex = 1
Top = 240
Width = 4335
_ExtentX = 7646
_ExtentY = 3625
_Version = 393216
AllowUpdate = 0 'False
BorderStyle = 0
HeadLines = 1
RowHeight = 15
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
MarqueeStyle = 3
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 840
Top = 0
Visible = 0 'False
Width = 1440
_ExtentX = 2540
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
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
End
End
Attribute VB_Name = "FrmRoomTypeMan"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Refresh_Type()
Dim TmpSource As String '保存SQL语句的变量
'设置查询语句
TmpSource = "SELECT TypeId, TypeName As 客户类型, RoomNum As 房间数量," _
+ " Bednum As 床位数, AirConditioning, Tel, Tv, Toilet, IceBox" _
+ " FROM RoomType ORDER BY TypeId"
'设置ADO控件的数据源
Adodc1.ConnectionString = Conn
Adodc1.RecordSource = TmpSource
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
'设置表格中各列的宽度
With DataGrid1
.Columns(0).Width = 0
.Columns(1).Width = 1500
.Columns(2).Width = 1200
.Columns(3).Width = 1200
.Columns(4).Width = 0
.Columns(5).Width = 0
.Columns(6).Width = 0
.Columns(7).Width = 0
.Columns(8).Width = 0
End With
End Sub
Private Sub Cmd_Add_Click()
'对FrmRoomTypeEdit窗体对象进行初始化
With FrmRoomTypeEdit
.Option1.Value = True
.Option3.Value = True
.Option5.Value = True
.Option7.Value = True
.Option9.Value = True
.txtBnum = 1
.txtRnum = 1
.Modify = False
.Show 1
End With
'刷新显示
Refresh_Type
Call DataGrid1_RowColChange(0, 0)
End Sub
Private Sub Cmd_Close_Click()
Unload Me
End Sub
Private Sub Cmd_Del_Click()
'判断是否选择了要删除的记录
If Adodc1.Recordset.EOF = True Then
MsgBox "请选择要删除的记录"
Exit Sub
End If
'要求用户确认删除
If MsgBox("是否删除当前记录", vbYesNo, "请确认") = vbYes Then
MyRoomType.Delete (Adodc1.Recordset.Fields(0))
Refresh_Type
End If
End Sub
Private Sub Cmd_Modi_Click()
'判断是否选择了要修改的记录
If Adodc1.Recordset.EOF = True Then
MsgBox "请选择要修改的记录"
Exit Sub
End If
'对FrmRoomTypeEdit窗体对象进行初始化
With FrmRoomTypeEdit
.OriTypeId = Adodc1.Recordset.Fields(0) '客房类型编号
.txtRtype = Trim(Adodc1.Recordset.Fields(1)) '客房类型
.OriType = Trim(Adodc1.Recordset.Fields(1))
.txtRnum = Adodc1.Recordset.Fields(2) '房间数量
.txtBnum = Adodc1.Recordset.Fields(3) '床位数量
.Option1.Value = Option1.Value
.Option2.Value = Option2.Value
.Option3.Value = Option3.Value
.Option4.Value = Option4.Value
.Option5.Value = Option5.Value
.Option6.Value = Option6.Value
.Option7.Value = Option7.Value
.Option8.Value = Option8.Value
.Option9.Value = Option9.Value
.Option10.Value = Option10.Value
'设置修改状态
.Modify = True
.Show 1
End With
'刷新显示
Refresh_Type
Call DataGrid1_RowColChange(0, 0)
End Sub
Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
'如果没有当前记录,则返回
If Adodc1.Recordset.EOF = True Then
Exit Sub
End If
'空调
If Adodc1.Recordset.Fields(4) = 0 Then
Option2.Value = True
Option1.Value = False
Else
Option1.Value = True
Option2.Value = False
End If
'电话
If Adodc1.Recordset.Fields(5) = 0 Then
Option4.Value = True
Option3.Value = False
Else
Option3.Value = True
Option4.Value = False
End If
'电视
If Adodc1.Recordset.Fields(6) = 0 Then
Option6.Value = True
Option5.Value = False
Else
Option5.Value = True
Option6.Value = False
End If
'独立卫生间
If Adodc1.Recordset.Fields(7) = 0 Then
Option8.Value = True
Option7.Value = False
Else
Option7.Value = True
Option8.Value = False
End If
'冰箱
If Adodc1.Recordset.Fields(8) = 0 Then
Option10.Value = True
Option9.Value = False
Else
Option9.Value = True
Option10.Value = False
End If
End Sub
Private Sub Form_Load()
'设置数据源,并刷新显示
Refresh_Type
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -