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

📄 frmroominfoedit.frm

📁 酒店收费系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmRoomInfoEdit 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Form1"
   ClientHeight    =   2595
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4860
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   ScaleHeight     =   173
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   324
   StartUpPosition =   1  '所有者中心
   Begin VB.TextBox txtRoomRate 
      Height          =   300
      Left            =   1245
      MaxLength       =   4
      TabIndex        =   1
      Text            =   "txtRoomRate"
      Top             =   2040
      Width           =   1800
   End
   Begin VB.ComboBox cboRoomType 
      Height          =   300
      Left            =   1245
      Style           =   2  'Dropdown List
      TabIndex        =   3
      TabStop         =   0   'False
      Top             =   1440
      Width           =   1800
   End
   Begin VB.ComboBox cboRoomGrade 
      Height          =   300
      Left            =   1245
      Style           =   2  'Dropdown List
      TabIndex        =   2
      TabStop         =   0   'False
      Top             =   840
      Width           =   1800
   End
   Begin VB.CommandButton cmdCancel 
      Caption         =   "取消(&C)"
      Height          =   375
      Left            =   3390
      TabIndex        =   9
      TabStop         =   0   'False
      Top             =   1995
      Width           =   1215
   End
   Begin VB.CommandButton cmdOk 
      Caption         =   "确定(&O)"
      Height          =   375
      Left            =   3390
      TabIndex        =   8
      TabStop         =   0   'False
      Top             =   1485
      Width           =   1215
   End
   Begin VB.TextBox txtRoomNo 
      Height          =   300
      Left            =   1245
      MaxLength       =   3
      TabIndex        =   0
      Top             =   240
      Width           =   1800
   End
   Begin VB.Label Label4 
      AutoSize        =   -1  'True
      Caption         =   "客房价格:"
      Height          =   180
      Left            =   285
      TabIndex        =   7
      Top             =   2085
      Width           =   900
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      Caption         =   "客房编号:"
      Height          =   180
      Left            =   285
      TabIndex        =   6
      Top             =   285
      Width           =   900
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "客房级别:"
      Height          =   180
      Left            =   285
      TabIndex        =   5
      Top             =   885
      Width           =   900
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "客房类型:"
      Height          =   180
      Left            =   285
      TabIndex        =   4
      Top             =   1485
      Width           =   900
   End
End
Attribute VB_Name = "frmRoomInfoEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdCancel_Click()
    '退出窗体
    Unload Me
End Sub

Private Sub cmdOk_Click()
    With frmMDI.adoRoom.Recordset
        If Not txtRoomNo.Locked Then '可修改状态表示是添加记录
            '控制编号不能为空
            If Trim(txtRoomNo.Text) = "" Then
                MsgBox "客房编号不能为空!", vbOKOnly + vbInformation, "提示"
                txtRoomNo.SetFocus
                Exit Sub
            End If
            '查看是否有相同编号
            .Find "RoomNo='" & txtRoomNo.Text & "'", , adSearchForward, 1
            If Not .EOF Then '有就提示,然后退出
                MsgBox "已经有相同编号的客房!", vbOKOnly + vbInformation, "提示"
                txtRoomNo.SetFocus
                Exit Sub
            End If
            If Trim(txtRoomRate.Text) = "" Then
                MsgBox "客房价格不能为空!", vbOKOnly + vbInformation, "提示"
                txtRoomRate.SetFocus
                Exit Sub
            End If
            '没有就添加记录
            .AddNew
            !RoomNo = Trim(txtRoomNo.Text)
        End If
        '给字段赋值
        !RoomNo = Trim(txtRoomNo.Text)
        If cboRoomGrade.ListIndex = 0 Then
            !RoomGrade = True
        Else
            !RoomGrade = False
        End If
        If cboRoomType.ListIndex = 0 Then
            !RoomType = True
        Else
            !RoomType = False
        End If
        !RoomRate = Val(Trim(txtRoomRate.Text))
        !RoomStatus = False
        .Update
        Unload Me
    End With
End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        KeyAscii = 0
        SendKeys "{TAB}"
    End If
End Sub
Private Sub Form_Load()
    Me.Left = (frmMDI.Width - Me.Width) / 2
    Me.Top = (frmMDI.Height - Me.Height) / 4
    '添加项目
    With cboRoomGrade
        .AddItem "标准间"
        .AddItem "豪华间"
    End With
    With cboRoomType
        .AddItem "单人间"
        .AddItem "双人间"
    End With
End Sub

Private Sub txtRoomNo_KeyPress(KeyAscii As Integer)
    If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 8 Then
        KeyAscii = 0
    End If
End Sub
Private Sub txtRoomRate_KeyPress(KeyAscii As Integer)
    If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 8 Then
        KeyAscii = 0
    End If
End Sub

⌨️ 快捷键说明

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