📄 roominfo.frm
字号:
Top = 270
Width = 720
End
End
Begin MSComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 615
Left = 0
TabIndex = 0
Top = 0
Width = 8535
_ExtentX = 15055
_ExtentY = 1085
ButtonWidth = 1138
ButtonHeight = 926
Appearance = 1
ImageList = "ImageList1"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 10
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "首记录"
Key = "first"
ImageIndex = 1
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "前记录"
Key = "before"
ImageIndex = 2
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "后记录"
Key = "next"
ImageIndex = 3
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "尾记录"
Key = "last"
ImageIndex = 4
EndProperty
BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "新增"
Key = "new"
ImageIndex = 5
EndProperty
BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "修改"
Key = "modify"
ImageIndex = 6
EndProperty
BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "删除"
Key = "delete"
ImageIndex = 7
EndProperty
BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
Enabled = 0 'False
Caption = "保存"
Key = "save"
ImageIndex = 8
EndProperty
BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628}
Enabled = 0 'False
Caption = "取消"
Key = "cancel"
ImageIndex = 9
EndProperty
BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "退出"
Key = "exit"
ImageIndex = 10
EndProperty
EndProperty
Begin MSComctlLib.ImageList ImageList1
Left = 7320
Top = 0
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 10
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "RoomInfo.frx":0015
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "RoomInfo.frx":0127
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "RoomInfo.frx":0239
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "RoomInfo.frx":034B
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "RoomInfo.frx":045D
Key = ""
EndProperty
BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "RoomInfo.frx":056F
Key = ""
EndProperty
BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "RoomInfo.frx":0681
Key = ""
EndProperty
BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "RoomInfo.frx":0793
Key = ""
EndProperty
BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "RoomInfo.frx":08A5
Key = ""
EndProperty
BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "RoomInfo.frx":09B7
Key = ""
EndProperty
EndProperty
End
End
Begin MSDataListLib.DataCombo RoomType
Bindings = "RoomInfo.frx":0AC9
DataField = "客房类型"
DataSource = "Adodc1"
Height = 330
Left = 2280
TabIndex = 4
Top = 4560
Width = 1215
_ExtentX = 2143
_ExtentY = 582
_Version = 393216
ListField = "客房类型"
BoundColumn = "客房类型"
Text = ""
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "楼层编号"
Height = 180
Left = 3960
TabIndex = 16
Top = 4320
Width = 720
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "客房类型"
Height = 180
Left = 2520
TabIndex = 15
Top = 4320
Width = 720
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "客房编号"
Height = 180
Left = 1080
TabIndex = 14
Top = 4320
Width = 720
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "客房描述"
Height = 180
Left = 5400
TabIndex = 13
Top = 4320
Width = 720
End
Begin VB.Label Label8
Caption = "状态"
Height = 255
Left = 6960
TabIndex = 12
Top = 4320
Width = 975
End
End
Attribute VB_Name = "RoomInfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub LoadData()
Dim str As String, str1 As String, flag%, mark%
If Len(Trim(Text1.Text)) = 0 Then '无客房编号
If Len(Trim(Text2.Text)) = 0 Then '无客房类型
flag = 0
Else '匹配客房类型
flag = 1: str1 = Text2.Text: mark = 2
End If
Else '匹配客房编号
flag = 1: str = Text1.Text: mark = 1
If Len(Trim(Text2.Text)) <> 0 Then '匹配客房编号和客房类型
flag = 2: str1 = Text2.Text: mark = 2
End If
End If
'根据查询条件重新填充DataGrid
If flag = 0 Then
OpenTable Adodc1, "select * from 客房信息 "
ElseIf flag = 1 And mark = 1 Then
OpenTable Adodc1, "select * from 客房信息 " + "where " + " 客房编号 " + " like '" + str + "%'"
ElseIf flag = 1 And mark = 2 Then
OpenTable Adodc1, "select * from 客房信息 " + "where " + " 客房类型 " + " like '" + str1 + "%'"
ElseIf flag = 2 And mark = 2 Then
OpenTable Adodc1, "select * from 客房信息 " + "where " + " 客房编号 " + " like '" + str + "%'" + " and " + " 客房类型 " + " like '" + str1 + "%'"
End If
End Sub
Private Sub RoomCode_LostFocus()
Dim str As String
str = Trim((Mid(RoomCode, 2, 1)))
FloorCode = str
End Sub
Private Sub Search_Click()
LoadData
End Sub
Private Sub Form_Load()
LoadData
SetTextBoxState (False)
End Sub
Private Sub SetToolBarState(ByVal State As Boolean)
'设置Button的是否能够单击
Toolbar1.Buttons("first").Enabled = State
Toolbar1.Buttons("before").Enabled = State
Toolbar1.Buttons("next").Enabled = State
Toolbar1.Buttons("last").Enabled = State
Toolbar1.Buttons("new").Enabled = State
Toolbar1.Buttons("modify").Enabled = State
Toolbar1.Buttons("delete").Enabled = State
Toolbar1.Buttons("save").Enabled = Not State
Toolbar1.Buttons("cancel").Enabled = Not State
End Sub
Private Sub SetTextBoxState(ByVal State As Boolean)
RoomCode.Enabled = State
RoomType.Enabled = State
Describe.Enabled = State
Status.Enabled = State
End Sub
Private Sub Clear()
RoomCode.Text = ""
RoomType.Text = ""
FloorCode.Text = ""
Describe.Text = ""
Status.Text = ""
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
If StrComp(Button.Key, "first") = 0 Then
If Not Adodc1.Recordset.BOF And Not Adodc1.Recordset.EOF Then Adodc1.Recordset.MoveFirst
ElseIf StrComp(Button.Key, "before") = 0 Then
If Not Adodc1.Recordset.BOF And Not Adodc1.Recordset.EOF Then
Adodc1.Recordset.MovePrevious
If Adodc1.Recordset.BOF Then Adodc1.Recordset.MoveFirst
End If
ElseIf StrComp(Button.Key, "next") = 0 Then
If Not Adodc1.Recordset.BOF And Not Adodc1.Recordset.EOF Then
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF Then Adodc1.Recordset.MoveLast
End If
ElseIf StrComp(Button.Key, "last") = 0 Then
If Not Adodc1.Recordset.BOF And Not Adodc1.Recordset.EOF Then Adodc1.Recordset.MoveLast
ElseIf StrComp(Button.Key, "new") = 0 Then
Adodc1.Recordset.AddNew
SetTextBoxState (True)
SetToolBarState (False)
Clear
ElseIf StrComp(Button.Key, "modify") = 0 Then
SetTextBoxState (True)
SetToolBarState (False)
ElseIf StrComp(Button.Key, "delete") = 0 Then
If Not Adodc1.Recordset.BOF And Not Adodc1.Recordset.EOF Then
If MsgBox("确定要删除吗?", vbYesNo, "提示") = vbYes Then
Adodc1.Recordset.Delete
Adodc1.Recordset.Update
End If
Else
MsgBox "无记录!", 64, "提示"
End If
ElseIf StrComp(Button.Key, "save") = 0 Then
SetTextBoxState (False)
SetToolBarState (True)
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.Update
ElseIf StrComp(Button.Key, "cancel") = 0 Then
SetTextBoxState (False)
SetToolBarState (True)
Form_Load
ElseIf StrComp(Button.Key, "exit") = 0 Then
LoadData
Unload Me
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -