?? room_info.frm
字號:
VERSION 5.00
Begin VB.Form room_info
BorderStyle = 3 'Fixed Dialog
Caption = "房間信息"
ClientHeight = 2205
ClientLeft = 4050
ClientTop = 3795
ClientWidth = 5535
Icon = "room_info.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
Moveable = 0 'False
ScaleHeight = 2205
ScaleWidth = 5535
ShowInTaskbar = 0 'False
WhatsThisButton = -1 'True
WhatsThisHelp = -1 'True
Begin VB.Frame Frame1
Caption = "信息"
Height = 2175
Left = 0
TabIndex = 0
Top = 0
Width = 5535
Begin VB.CommandButton exit
Caption = "退 出"
Height = 375
Left = 480
TabIndex = 14
Top = 1560
Width = 855
End
Begin VB.TextBox now_num
Enabled = 0 'False
Height = 270
Left = 3960
TabIndex = 13
Top = 680
Width = 1215
End
Begin VB.TextBox room_id
Enabled = 0 'False
Height = 270
Left = 3960
TabIndex = 12
Top = 320
Width = 1215
End
Begin VB.CommandButton addnew
Caption = "添 加"
Height = 375
Left = 3960
TabIndex = 9
Top = 1560
Width = 1095
End
Begin VB.CommandButton save
Caption = "保 存"
Height = 375
Left = 2760
TabIndex = 8
Top = 1560
Width = 975
End
Begin VB.CommandButton delete
Caption = "刪 除"
Height = 375
Left = 1560
TabIndex = 7
Top = 1560
Width = 975
End
Begin VB.TextBox room_info
Height = 270
Left = 1440
MaxLength = 100
TabIndex = 6
Top = 1040
Width = 3735
End
Begin VB.TextBox max_num
Height = 270
Left = 1440
MaxLength = 3
TabIndex = 5
Top = 680
Width = 1215
End
Begin VB.TextBox room_name
Height = 270
Left = 1440
MaxLength = 10
TabIndex = 4
Top = 320
Width = 1215
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "目前人數(shù):"
Height = 180
Left = 3000
TabIndex = 11
Top = 720
Width = 900
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "房間ID:"
Height = 180
Left = 3000
TabIndex = 10
Top = 360
Width = 720
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "房間信息:"
Height = 180
Left = 360
TabIndex = 3
Top = 1080
Width = 900
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "最大人數(shù):"
Height = 180
Left = 360
TabIndex = 2
Top = 720
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "房間名稱:"
Height = 180
Left = 360
TabIndex = 1
Top = 360
Width = 900
End
End
End
Attribute VB_Name = "room_info"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub addnew_Click()
room_id.Text = ""
room_name.Text = ""
max_num.Text = 10
room_info.Text = ""
addnew.Enabled = False
End Sub
Private Sub delete_Click()
On Error Resume Next
conn.execute "delete from room where room_id=" + room_id.Text
Call refresh_db
End Sub
Private Sub refresh_db()
rs.Close
rs.open "select room_id as 房間號,room_name as 房間名,max_num as 最大人數(shù),now_num as 現(xiàn)有人數(shù),room_info as 房間信息 from room order by room_id", conn, 1, 2
Set room_setup.room_gd.DataSource = rs
room_setup.room_gd.Refresh
End Sub
Private Sub exit_Click()
Unload Me
End Sub
Private Sub Form_Load()
On Error Resume Next
If Not rs.EOF Then
room_name.Text = Trim(rs("房間名"))
room_id.Text = rs("房間號")
max_num.Text = rs("最大人數(shù)")
now_num.Text = rs("現(xiàn)有人數(shù)")
room_info.Text = rs("房間信息")
End If
End Sub
Private Sub save_Click()
If room_name.Text = "" Then
MsgBox "請輸入房間名稱", vbOKOnly, "提示"
Exit Sub
End If
If max_num.Text = "" Or Not IsNumeric(max_num.Text) Then
MsgBox "請正確輸入房間最大人數(shù)", vbOKOnly, "提示"
Exit Sub
End If
If addnew.Enabled = True Then
rs("房間名") = room_name.Text
rs("最大人數(shù)") = max_num.Text
rs("房間信息") = room_info.Text
rs.Update
MsgBox "修改信息完成,請退出", vbOKOnly, "提示"
Else
rs.addnew
rs("房間名") = room_name.Text
rs("最大人數(shù)") = max_num.Text
rs("房間信息") = room_info.Text
rs.Update
MsgBox "增加房間成功,請退出", vbOKOnly, "提示"
End If
Call refresh_db
Unload Me
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -