?? 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
Caption = "客房類型管理"
ClientHeight = 3540
ClientLeft = 60
ClientTop = 450
ClientWidth = 8325
LinkTopic = "Form1"
ScaleHeight = 3540
ScaleWidth = 8325
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame1
Caption = "客房類型列表"
Height = 2415
Left = 0
TabIndex = 19
Top = 0
Width = 4575
Begin MSDataGridLib.DataGrid DataGrid1
Height = 2055
Left = 240
TabIndex = 20
Top = 480
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
Begin VB.Frame Frame2
Caption = "空調"
Height = 735
Left = 4680
TabIndex = 16
Top = 0
Width = 1695
Begin VB.OptionButton Option1
Caption = "有"
Height = 375
Left = 240
TabIndex = 18
Top = 240
Width = 495
End
Begin VB.OptionButton Option2
Caption = "無"
Height = 375
Left = 960
TabIndex = 17
Top = 263
Width = 495
End
End
Begin VB.CommandButton Cmd_Close
Caption = "關 閉"
Height = 495
Left = 6233
MouseIcon = "FrmRoomTypeMan.frx":0000
MousePointer = 99 'Custom
TabIndex = 15
Top = 2640
Width = 1215
End
Begin VB.CommandButton Cmd_Del
Caption = "刪 除"
Height = 495
Left = 4388
MouseIcon = "FrmRoomTypeMan.frx":030A
MousePointer = 99 'Custom
TabIndex = 14
Top = 2640
Width = 1215
End
Begin VB.CommandButton Cmd_Modi
Caption = "修 改"
Height = 495
Left = 2558
MouseIcon = "FrmRoomTypeMan.frx":0614
MousePointer = 99 'Custom
TabIndex = 13
Top = 2640
Width = 1215
End
Begin VB.CommandButton Cmd_Add
Caption = "添 加"
Height = 495
Left = 713
MouseIcon = "FrmRoomTypeMan.frx":091E
MousePointer = 99 'Custom
TabIndex = 12
Top = 2640
Width = 1215
End
Begin VB.Frame Frame6
Caption = "冰箱"
Height = 735
Left = 4680
TabIndex = 9
Top = 1680
Width = 1695
Begin VB.OptionButton Option10
Caption = "無"
Height = 375
Left = 960
TabIndex = 11
Top = 240
Width = 495
End
Begin VB.OptionButton Option9
Caption = "有"
Height = 375
Left = 240
TabIndex = 10
Top = 240
Width = 495
End
End
Begin VB.Frame Frame5
Caption = "獨立衛生間"
Height = 735
Left = 6480
TabIndex = 6
Top = 840
Width = 1695
Begin VB.OptionButton Option8
Caption = "無"
Height = 375
Left = 960
TabIndex = 8
Top = 240
Width = 495
End
Begin VB.OptionButton Option7
Caption = "有"
Height = 375
Left = 240
TabIndex = 7
Top = 240
Width = 495
End
End
Begin VB.Frame Frame3
Caption = "電話"
Height = 735
Left = 6480
TabIndex = 3
Top = 0
Width = 1695
Begin VB.OptionButton Option4
Caption = "無"
Height = 375
Left = 960
TabIndex = 5
Top = 240
Width = 495
End
Begin VB.OptionButton Option3
Caption = "有"
Height = 375
Left = 240
TabIndex = 4
Top = 240
Width = 495
End
End
Begin VB.Frame Frame4
Caption = "電視"
Height = 735
Left = 4680
TabIndex = 0
Top = 840
Width = 1695
Begin VB.OptionButton Option6
Caption = "無"
Height = 375
Left = 960
TabIndex = 2
Top = 240
Width = 495
End
Begin VB.OptionButton Option5
Caption = "有"
Height = 375
Left = 240
TabIndex = 1
Top = 240
Width = 495
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 + -