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

📄

📁 酒店宾馆管理系统 包括住房管理 查询客户还有住客人数
💻
字号:
VERSION 5.00
Begin VB.Form frmAdd 
   Caption         =   "添加"
   ClientHeight    =   3510
   ClientLeft      =   3060
   ClientTop       =   2940
   ClientWidth     =   6210
   LinkTopic       =   "Form2"
   ScaleHeight     =   3510
   ScaleWidth      =   6210
   Begin VB.CommandButton cmdClear 
      Caption         =   "清除"
      Height          =   495
      Left            =   1560
      TabIndex        =   16
      Top             =   2880
      Width           =   975
   End
   Begin VB.CommandButton cmdAdd 
      Caption         =   "添加"
      Height          =   495
      Left            =   240
      TabIndex        =   15
      Top             =   2880
      Width           =   1095
   End
   Begin VB.ComboBox cboRoom 
      Height          =   300
      Left            =   3600
      TabIndex        =   14
      Top             =   2040
      Width           =   2415
   End
   Begin VB.ComboBox cboTitle 
      Height          =   300
      Left            =   3600
      TabIndex        =   12
      Top             =   1440
      Width           =   2415
   End
   Begin VB.TextBox txtCompany 
      Height          =   375
      Left            =   3600
      TabIndex        =   10
      Top             =   720
      Width           =   2415
   End
   Begin VB.VScrollBar vsbAge 
      Height          =   375
      Left            =   1920
      Max             =   1
      Min             =   100
      TabIndex        =   8
      Top             =   2160
      Value           =   1
      Width           =   255
   End
   Begin VB.TextBox txtAge 
      Height          =   375
      Left            =   840
      TabIndex        =   7
      Top             =   2160
      Width           =   855
   End
   Begin VB.Frame fraSex 
      Caption         =   "性别"
      Height          =   735
      Left            =   240
      TabIndex        =   3
      Top             =   1320
      Width           =   1935
      Begin VB.OptionButton optFemale 
         Caption         =   "女"
         Height          =   375
         Left            =   1080
         TabIndex        =   5
         Top             =   240
         Width           =   615
      End
      Begin VB.OptionButton optMale 
         Caption         =   "男"
         Height          =   375
         Left            =   360
         TabIndex        =   4
         Top             =   240
         Width           =   735
      End
   End
   Begin VB.TextBox txtName 
      Height          =   375
      Left            =   960
      TabIndex        =   1
      Top             =   720
      Width           =   1215
   End
   Begin VB.CommandButton cmdReturn 
      Caption         =   "返回主窗口"
      Height          =   495
      Left            =   4560
      TabIndex        =   0
      Top             =   2880
      Width           =   1455
   End
   Begin VB.Line Line2 
      X1              =   120
      X2              =   6000
      Y1              =   2760
      Y2              =   2760
   End
   Begin VB.Line Line1 
      X1              =   120
      X2              =   6000
      Y1              =   600
      Y2              =   600
   End
   Begin VB.Label lable1 
      Caption         =   "添加"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   26.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000FF&
      Height          =   495
      Left            =   0
      TabIndex        =   17
      Top             =   0
      Width           =   1095
   End
   Begin VB.Label lblRoom 
      Caption         =   "房间号:"
      Height          =   255
      Left            =   2640
      TabIndex        =   13
      Top             =   2160
      Width           =   735
   End
   Begin VB.Label lblTitle 
      Caption         =   "职称:"
      Height          =   375
      Left            =   2880
      TabIndex        =   11
      Top             =   1560
      Width           =   615
   End
   Begin VB.Label lblCompany 
      Caption         =   "工作单位:"
      Height          =   375
      Left            =   2520
      TabIndex        =   9
      Top             =   840
      Width           =   975
   End
   Begin VB.Label lalAge 
      Caption         =   "年龄:"
      Height          =   375
      Left            =   240
      TabIndex        =   6
      Top             =   2280
      Width           =   615
   End
   Begin VB.Label lblName 
      Caption         =   "姓名:"
      Height          =   375
      Left            =   240
      TabIndex        =   2
      Top             =   840
      Width           =   615
   End
End
Attribute VB_Name = "frmAdd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
    Option Explicit
    Private Sub Form_Load()
        Dim str1 As String
        If Dir(strTitle) <> "" Then                         '如果文件存在则打开
            Open strTitle For Input As 1
            Do While Not EOF(1)
                Input #1, str1
                cboTitle.AddItem str1
            Loop
            Close 1
        End If
        If Dir(strRoomNo) <> "" Then                     '如果文件存在则打开
            Open strRoomNo For Input As 2
            Do While Not EOF(2)
                Input #2, str1
                cboRoom.AddItem str1
            Loop
            Close 2
        End If
        vsbAge.Value = 40                                       '年龄的默认值为40
        optMale.Value = True                                    '性别的默认值为男
    End Sub
    
    Private Sub cmdAdd_Click()
        Dim NewGuest As guest                '自定义类型的变量
        Dim int1 As Integer
        If Len(Trim(CStr(txtName.Text))) = 0 Then   '姓名一栏不能空
              MsgBox ("一定要输入姓名!")
              Exit Sub
        End If
        
        NewGuest.blnIsIn = True                  '搜集住客信息
        NewGuest.blnSex = optMale.Value
        NewGuest.bytAge = CInt(txtAge.Text)
        NewGuest.dtmIn = Now                        '当前日期时间
        NewGuest.strCompany = txtCompany.Text
        NewGuest.strName = txtName.Text
        NewGuest.strTitle = cboTitle.Text
        NewGuest.strRoom = cboRoom.Text
        
        If Dir(strGuestNum) = "" Then               '如果文件不存在,则新建文件
            int1 = 0
        Else
            Open strGuestNum For Input As 1
            Input #1, int1
            Close 1
        End If
        Open strGuestNum For Output As 1
        Write #1, int1 + 1
        Close 1
        
        Open strGuestData For Random As 1 Len = Len(NewGuest)
        Put #1, int1 + 1, NewGuest
        Close 1
        '如果数据文件中没有这个职称,则把它添加到数据文件中
        For int1 = 0 To cboTitle.ListCount - 1
                If Trim(cboTitle.Text) = Trim(cboTitle.List(int1)) Then
                    Exit For
                End If
        Next
        If int1 = cboTitle.ListCount Then
            Open strTitle For Append As 1
            cboTitle.AddItem Trim(cboTitle.Text)
            Write #1, Trim(cboTitle.Text)
            Close 1
        End If
        
        '如果数据文件中没有这个房间号,则把它添加到数据文件中
        For int1 = 0 To cboRoom.ListCount - 1
                If Trim(cboRoom.Text) = Trim(cboRoom.List(int1)) Then
                    Exit For
                End If
        Next
        If int1 = cboRoom.ListCount Then
            Open strRoomNo For Append As 1
            cboRoom.AddItem Trim(cboRoom.Text)
            Write #1, Trim(cboRoom.Text)
            Close 1
        End If
        
        ClearControl      '清空所有控件内容
    End Sub
    
    Private Sub vsbAge_Scroll()
       txtAge.Text = vsbAge.Value
    End Sub
    Private Sub vsbAge_Change()
        txtAge.Text = vsbAge.Value
    End Sub
    Private Sub cmdClear_Click()
        Call ClearControl   '清空所有控件内容
    End Sub
    Private Sub cmdReturn_Click()
        Unload Me                       '关闭窗口,回到主窗口
    End Sub
    
    Private Sub ClearControl()                  '通用过程
        txtName.Text = ""
        txtAge.Text = "40"
        txtCompany.Text = ""
        cboTitle.Text = ""
        cboRoom.Text = ""
        optMale.Value = True
    End Sub

⌨️ 快捷键说明

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