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

📄 main_kfgl.frm

📁 宾馆客房管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form main_kfgl 
   BackColor       =   &H00C0C0C0&
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "客房设置"
   ClientHeight    =   5130
   ClientLeft      =   675
   ClientTop       =   1890
   ClientWidth     =   8505
   Icon            =   "main_kfgl.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   5130
   ScaleWidth      =   8505
   ShowInTaskbar   =   0   'False
   StartUpPosition =   1  '所有者中心
   Begin MSDataGridLib.DataGrid DataGrid1 
      Height          =   1815
      Left            =   120
      TabIndex        =   18
      Top             =   2520
      Width           =   8295
      _ExtentX        =   14631
      _ExtentY        =   3201
      _Version        =   393216
      AllowUpdate     =   0   'False
      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 
         BeginProperty Column00 
         EndProperty
         BeginProperty Column01 
         EndProperty
      EndProperty
   End
   Begin VB.CommandButton Comdj 
      BackColor       =   &H00C0C0C0&
      Caption         =   "登记"
      Height          =   345
      Left            =   3375
      Style           =   1  'Graphical
      TabIndex        =   17
      Top             =   4560
      UseMaskColor    =   -1  'True
      Width           =   1185
   End
   Begin VB.Frame Frame1 
      Height          =   2520
      Left            =   30
      TabIndex        =   3
      Top             =   -45
      Width           =   8415
      Begin VB.TextBox Texpz 
         Height          =   375
         Left            =   1110
         TabIndex        =   11
         Top             =   1590
         Width           =   7185
      End
      Begin VB.TextBox Texbz 
         Height          =   375
         Left            =   1110
         TabIndex        =   10
         Top             =   2025
         Width           =   7185
      End
      Begin VB.TextBox Texfjh 
         Height          =   360
         Left            =   1110
         TabIndex        =   9
         Top             =   225
         Width           =   3030
      End
      Begin VB.TextBox Texjg 
         Height          =   360
         Left            =   5565
         TabIndex        =   8
         Top             =   690
         Width           =   2685
      End
      Begin VB.TextBox Texsz 
         Height          =   360
         Left            =   5565
         TabIndex        =   7
         Top             =   1140
         Width           =   2685
      End
      Begin VB.ComboBox Comboft 
         Height          =   300
         ItemData        =   "main_kfgl.frx":000C
         Left            =   1110
         List            =   "main_kfgl.frx":0019
         Style           =   2  'Dropdown List
         TabIndex        =   5
         Top             =   690
         Width           =   3000
      End
      Begin VB.ComboBox Combofjlx 
         Height          =   300
         ItemData        =   "main_kfgl.frx":002F
         Left            =   5520
         List            =   "main_kfgl.frx":003F
         TabIndex        =   4
         Text            =   "普房"
         Top             =   210
         Width           =   2655
      End
      Begin MSComCtl2.DTPicker DTP1 
         Height          =   345
         Left            =   1110
         TabIndex        =   6
         Top             =   1110
         Width           =   3030
         _ExtentX        =   5345
         _ExtentY        =   609
         _Version        =   393216
         Format          =   160104449
         CurrentDate     =   37142
      End
      Begin VB.Label Label1 
         BackStyle       =   0  'Transparent
         Caption         =   "房间号           房态    "
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   795
         Left            =   90
         TabIndex        =   16
         Top             =   255
         Width           =   975
      End
      Begin VB.Label Label2 
         BackStyle       =   0  'Transparent
         Caption         =   "房间类型            价格"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   780
         Left            =   4320
         TabIndex        =   15
         Top             =   255
         Width           =   1110
      End
      Begin VB.Label Label3 
         BackStyle       =   0  'Transparent
         Caption         =   " 配置            备注:                 "
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   795
         Left            =   120
         TabIndex        =   14
         Top             =   1605
         Width           =   975
      End
      Begin VB.Label Label5 
         BackStyle       =   0  'Transparent
         Caption         =   "营业日期"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   420
         Left            =   60
         TabIndex        =   13
         Top             =   1170
         Width           =   1080
      End
      Begin VB.Label Label6 
         BackStyle       =   0  'Transparent
         Caption         =   "使用设置"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   420
         Left            =   4305
         TabIndex        =   12
         Top             =   1170
         Width           =   1080
      End
   End
   Begin VB.CommandButton Comend 
      BackColor       =   &H00C0C0C0&
      Caption         =   "退出"
      Height          =   345
      Left            =   7275
      Style           =   1  'Graphical
      TabIndex        =   2
      Top             =   4560
      Width           =   1155
   End
   Begin VB.CommandButton Comcancel 
      BackColor       =   &H00C0C0C0&
      Caption         =   "取消"
      Height          =   330
      Left            =   5985
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   4560
      Width           =   1155
   End
   Begin VB.CommandButton Comsave 
      BackColor       =   &H00C0C0C0&
      Caption         =   "保存"
      Enabled         =   0   'False
      Height          =   345
      Left            =   4665
      Style           =   1  'Graphical
      TabIndex        =   0
      Top             =   4560
      UseMaskColor    =   -1  'True
      Width           =   1185
   End
End
Attribute VB_Name = "main_kfgl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim DBcnn As New ADODB.Connection
Dim DBrs As New ADODB.Recordset
Dim sqlstr As String
Private Sub Form_Load()
 If DBcnn.State = 0 Then
    Dim connectstr As String
    connectstr = "Provider=Microsoft.jet.OLEDB.4.0;Data Source=" & _
               App.Path & "\KFGL.mdb;Persist Security Info=False"
    DBcnn.CursorLocation = adUseClient
    DBcnn.Open connectstr
 End If
 If DBrs.State = 1 Then
    DBrs.Close
 End If
 sqlstr = "select * from kf "
 DBrs.Open sqlstr, DBcnn, adOpenDynamic, adLockBatchOptimistic
 Set DataGrid1.DataSource = DBrs
End Sub
Private Sub Form_Unload(Cancel As Integer)
 main.Enabled = True
End Sub
Private Sub Combofjlx_KeyDown(KeyCode As Integer, Shift As Integer)
 '判断用户是否在“房间号”对应的文本框中按下了回车键
 If KeyCode = vbKeyReturn Then
    '用户在“房间号”对应的文本框中按下了回车键,将焦点定位到“房态”对应的文本框上。
    Comboft.SetFocus
 End If
  '设置数据集对象DBrs的filter属性,以返回酒店客房表(kf)
  '中与为输入或选择的客房类型相同的所有房间
 sqlstr = "select * from kf where 房间类型='" & Combofjlx.Text & "'"
 DBrs.Filter = sqlstr
 '在“价格”对应的文本框中显示该种房间类型的价格
 If DBrs.RecordCount > 0 Then Texjg.Text = DBrs.Fields("价格")
End Sub
Private Sub texfjh_KeyDown(KeyCode As Integer, Shift As Integer)
 If KeyCode = vbKeyReturn Then Combofjlx.SetFocus     '按回车键Combofjlx获得焦点
End Sub
Private Sub Comboft_KeyDown(KeyCode As Integer, Shift As Integer)
 If KeyCode = vbKeyReturn Then Texjg.SetFocus
End Sub
Private Sub texjg_KeyDown(KeyCode As Integer, Shift As Integer)
 If KeyCode = vbKeyReturn Then DTP1.SetFocus
End Sub
Private Sub DTP1_KeyDown(KeyCode As Integer, Shift As Integer)
 If KeyCode = vbKeyReturn Then Texsz.SetFocus     '按回车键Texsz获得焦点
End Sub
Private Sub texsz_KeyDown(KeyCode As Integer, Shift As Integer)
 If KeyCode = vbKeyReturn Then Texpz.SetFocus
End Sub
Private Sub texpz_KeyDown(KeyCode As Integer, Shift As Integer)
 If KeyCode = vbKeyReturn Then Texbz.SetFocus
End Sub
Private Sub texbz_KeyDown(KeyCode As Integer, Shift As Integer)
 If KeyCode = vbKeyReturn Then Comsave.SetFocus
End Sub
Private Sub comdj_Click()    '登记
 Texfjh.Text = ""
 Texjg.Text = ""
 Texsz.Text = ""
 Texpz.Text = ""
 Texbz.Text = ""
 Comsave.Enabled = True
 Comcancel.Enabled = True
 Comdj.Enabled = False
 Texfjh.SetFocus
End Sub
Private Sub comsave_Click()
 '设置DBrs3的filter属性以返回酒店客房(kf)中等于用户输入的房间号的记录
 sqlstr = "房间号 like '" & Texfjh.Text & "'"
 DBrs.Filter = sqlstr
 '判断酒店客房(kf)中是否存在用户输入的房间号
 If DBrs.EOF Then
 '在酒店客房(kf)中不存在用户输入的房间号,在该表中添加一条酒店房间记录
  DBrs.AddNew
  '设置新添加的酒店客房信息记录的各个字段的值
  If Texfjh.Text <> "" Then DBrs.Fields("房间号") = Texfjh.Text
  If Combofjlx.Text <> "" Then DBrs.Fields("房间类型") = Combofjlx.Text
  If Comboft.Text <> "" Then DBrs.Fields("房态") = Comboft.Text
  If Texjg.Text <> "" Then DBrs.Fields("价格") = Texjg.Text
  If DTP1.Value <> "" Then DBrs.Fields("营业日期") = DTP1.Value
  If Texsz.Text <> "" Then DBrs.Fields("使用设置") = Texsz.Text
  If Texpz.Text <> "" Then DBrs.Fields("配置") = Texpz.Text
  If Texbz.Text <> "" Then DBrs.Fields("备注") = Texbz.Text
  If Texfjh.Text <> "" Then DBrs.Fields("标志") = "0"
  '提交所作的添加
  DBrs.UpdateBatch
  '刷新显示客房信息的DataGrid1控件
  DataGrid1.Refresh
 Else
 '编辑客房信息
 '在酒店客房(kf)中存在用户输入的房间号,编辑该条酒店房间记录
  If Texfjh.Text <> "" Then DBrs.Fields("房间号") = Texfjh.Text
  If Comboft.Text <> "" Then DBrs.Fields("房态") = Comboft.Text
  If Combofjlx.Text <> "" Then DBrs.Fields("房间类型") = Combofjlx.Text
  If Texjg.Text <> "" Then DBrs.Fields("价格") = Texjg.Text
  If DTP1.Value <> "" Then DBrs.Fields("营业日期") = DTP1.Value
  If Texsz.Text <> "" Then DBrs.Fields("使用设置") = Texsz.Text
  If Texpz.Text <> "" Then DBrs.Fields("配置") = Texpz.Text
  If Texbz.Text <> "" Then DBrs.Fields("备注") = Texbz.Text
  If Texfjh.Text <> "" Then DBrs.Fields("标志") = "0"
  '提交所作的修改
  DBrs.UpdateBatch
  '刷新显示客房信息的DataGrid1控件
  DataGrid1.Refresh
 End If
'设置命令按钮的使能状态
 Comsave.Enabled = False
 Comcancel.Enabled = False
 Comend.Enabled = True
 Comdj.Enabled = True
End Sub
Private Sub comcancel_Click()     '取消操作
 Texfjh.Text = ""
 Texjg.Text = ""
 Texsz.Text = ""
 Texpz.Text = ""
 Texbz.Text = ""
 Comsave.Enabled = False
 Comcancel.Enabled = False
 Comdj.Enabled = True
End Sub
Private Sub comend_Click()
 main.Enabled = True
 Unload Me
End Sub

⌨️ 快捷键说明

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