⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 room_info.frm

📁 一个VB做的语音系统控件
💻 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         =   "目前人数:"
         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         =   "最大人数:"
         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 最大人数,now_num as 现有人数,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("最大人数")
    now_num.Text = rs("现有人数")
    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 "请正确输入房间最大人数", vbOKOnly, "提示"
       Exit Sub
   End If
   If addnew.Enabled = True Then
       rs("房间名") = room_name.Text
       rs("最大人数") = max_num.Text
       rs("房间信息") = room_info.Text
       rs.Update
       MsgBox "修改信息完成,请退出", vbOKOnly, "提示"
   Else
       rs.addnew
       rs("房间名") = room_name.Text
       rs("最大人数") = max_num.Text
       rs("房间信息") = room_info.Text
       rs.Update
       MsgBox "增加房间成功,请退出", vbOKOnly, "提示"
   End If
       Call refresh_db
       Unload Me
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -