📄 frmroom.frm
字号:
_ExtentX = 13573
_ExtentY = 9472
_Version = 393216
Cols = 8
FixedCols = 0
BackColorFixed = 14737632
BackColorBkg = -2147483643
Appearance = 0
End
Begin VB.Label Label1
Appearance = 0 'Flat
BackColor = &H80000005&
BackStyle = 0 'Transparent
BorderStyle = 1 'Fixed Single
Caption = " 房 间 信 息 列 表"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H8000000D&
Height = 375
Left = 5280
TabIndex = 14
Top = 360
Width = 7695
End
Begin VB.Label Label2
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
BorderStyle = 1 'Fixed Single
Caption = " 添加房间"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 375
Index = 0
Left = 720
TabIndex = 13
Top = 360
Width = 1215
End
Begin VB.Label Label2
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
BorderStyle = 1 'Fixed Single
Caption = "修改房间信息"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 375
Index = 1
Left = 1920
TabIndex = 12
Top = 360
Width = 1575
End
Begin VB.Label Label2
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
BorderStyle = 1 'Fixed Single
Caption = " 删除房间"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 375
Index = 2
Left = 3240
TabIndex = 11
Top = 360
Width = 1455
End
End
Attribute VB_Name = "frmroom"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim mrc As ADODB.Recordset
Dim MsgText As String
Dim tSQL As String
Private Sub ShowData()
Dim txSQL As String
Dim mrcc As ADODB.Recordset
txSQL = "select * from room_Form"
Set mrcc = ExecuteSQL(txSQL, MsgText)
With MSFlexGrid1
.ColWidth(0) = 1000
.ColWidth(1) = 1000
.ColWidth(2) = 1000
.ColWidth(3) = 1000
.ColWidth(4) = 1000
.ColWidth(5) = 1000
.ColWidth(6) = 1000
.ColWidth(7) = 1000
.TextMatrix(0, 0) = "房间号码"
.TextMatrix(0, 1) = "入住性别"
.TextMatrix(0, 2) = "电话号码"
.TextMatrix(0, 3) = "电话端口"
.TextMatrix(0, 4) = "网线端口"
.TextMatrix(0, 5) = "可住人数"
.TextMatrix(0, 6) = "水表底数"
.TextMatrix(0, 7) = "电表底数"
.Rows = 1
Do While Not mrcc.EOF
.Rows = .Rows + 1
For i = 0 To mrcc.Fields.Count - 1
.TextMatrix(.Rows - 1, i) = mrcc.Fields(i) & ""
Next i
mrcc.MoveNext
Loop
End With
mrcc.Close
End Sub
Private Sub Command1_Click()
Dim txtSQL As String
Dim txSQL As String
If Text1(0) = "" Then
MsgBox "房间号码不能为空!", vbOKOnly, "提示"
Text1(0).SetFocus
Exit Sub
End If
txSQL = "select * from room_Form where room_NO='" & Trim(Text1(0)) & "'"
Set mrc = ExecuteSQL(txSQL, MsgText)
If mrc.EOF = False Then
MsgBox "此房间已经存在!", vbOKOnly, "警告"
Text1(0).SetFocus
Exit Sub
End If
mrc.Close
txSQL = "select * from room_Form"
Set mrc = ExecuteSQL(txSQL, MsgText)
mrc.AddNew
mrc.Fields(0) = Trim(Text1(0))
mrc.Fields(1) = Trim(Combo1)
mrc.Fields(2) = Trim(Text1(1))
mrc.Fields(3) = Trim(Text1(2))
mrc.Fields(4) = Trim(Text1(3))
mrc.Fields(5) = Trim(Text1(4))
mrc.Fields(6) = Trim(Text1(5))
mrc.Fields(7) = Trim(Text1(6))
mrc.Update
txtSQL = "select * from room_stud"
Set mrc = ExecuteSQL(txtSQL, MsgText)
mrc.AddNew
mrc.Fields(0) = Trim(Text1(0))
mrc.Fields(1) = Trim(Combo1)
mrc.Fields(2) = Trim(Text1(1))
mrc.Fields(3) = Trim(Text1(4))
mrc.Fields(4) = 0
mrc.Fields(5) = Trim(Text1(4))
mrc.Update
mrc.Close
For i = 0 To 6
Text1(i) = ""
Next
MsgBox "房间信息添加成功!", vbOKOnly, "提示"
ShowData
End Sub
Private Sub Command2_Click()
For i = 0 To 6
Text1(i) = ""
Next
End Sub
Private Sub Command3_Click()
Dim txtSQL As String
If Text1(7) = "" Then
MsgBox "房间号码不能为空!", vbOKOnly, "提示"
Text1(5).SetFocus
Exit Sub
End If
txtSQL = "delete from room_Form where room_NO='" & Trim(Text1(7)) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
'mrc.Update
'mrc.Close
txtSQL = "select * from room_Form"
Set mrc = ExecuteSQL(txtSQL, MsgText)
mrc.AddNew
mrc.Fields(0) = Trim(Text1(7))
mrc.Fields(1) = Trim(Combo2)
mrc.Fields(2) = Trim(Text1(8))
mrc.Fields(3) = Trim(Text1(9))
mrc.Fields(4) = Trim(Text1(10))
mrc.Fields(5) = Trim(Text1(11))
mrc.Fields(6) = Trim(Text1(12))
mrc.Fields(7) = Trim(Text1(13))
mrc.Update
mrc.Close
For i = 7 To 13
Text1(i) = ""
Next
MsgBox "房间信息修改成功!", vbOKOnly, "提示"
ShowData
End Sub
Private Sub Command4_Click()
For i = 7 To 13
Text1(i) = ""
Next
End Sub
Private Sub Command5_Click()
Dim txtSQL As String
txtSQL = "delete from room_Form where room_NO='" & Trim(Text1(14)) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
For i = 14 To 20
Text1(i) = ""
Next
MsgBox "该房间信息已被删除!", vbOKOnly, "警告"
ShowData
End Sub
Private Sub Command6_Click()
For i = 14 To 20
Text1(i) = ""
Next
End Sub
Private Sub Form_Load()
Picture1(1).Top = Picture1(0).Top
Picture1(1).Left = Picture1(0).Left
Picture1(2).Top = Picture1(0).Top
Picture1(2).Left = Picture1(0).Left
ShowData
For i = 0 To 2
Label2(i).BackColor = &HE0E0E0
Picture1(i).Visible = False
Next
Label2(0).BackColor = &HFFFFFF
Picture1(0).Visible = True
With Combo1
.AddItem "男"
.AddItem "女"
End With
Combo1.Text = "男"
End Sub
Private Sub Label2_Click(Index As Integer)
Me.Caption = "房间设置"
Me.Caption = Me.Caption & "->" & Trim(Label2(Index).Caption)
For i = 0 To 2
Label2(i).BackColor = &HE0E0E0
Picture1(i).Visible = False
Next
Label2(Index).BackColor = &HFFFFFF
Picture1(Index).Visible = True
For i = 0 To 20
Text1(i) = ""
Next
Command3.Enabled = False
Command5.Enabled = False
End Sub
Private Sub MSFlexGrid1_Click()
If Picture1(1).Visible = True Then
Text1(7) = Trim(MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 0))
Combo2 = Trim(MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 1))
Text1(8) = Trim(MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 2))
Text1(9) = Trim(MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 3))
Text1(10) = Trim(MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 4))
Text1(11) = Trim(MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 5))
Text1(12) = Trim(MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 6))
Text1(13) = Trim(MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 7))
With Combo2
.AddItem "男"
.AddItem "女"
End With
Command3.Enabled = True
End If
If Picture1(2).Visible = True Then
Text1(14) = Trim(MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 0))
Combo3 = Trim(MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 1))
Text1(15) = Trim(MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 2))
Text1(16) = Trim(MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 3))
Text1(17) = Trim(MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 4))
Text1(18) = Trim(MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 5))
Text1(19) = Trim(MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 6))
Text1(20) = Trim(MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 7))
With Combo3
.AddItem "男"
.AddItem "女"
End With
Command5.Enabled = True
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -