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

📄 frmsetroomtype.frm

📁 智能门锁的程序,用于控制门锁发卡程序,是科布尔的
💻 FRM
字号:
VERSION 5.00
Begin VB.Form FrmSetRoomType 
   BackColor       =   &H00C0C0C0&
   Caption         =   "房间类型"
   ClientHeight    =   3696
   ClientLeft      =   1884
   ClientTop       =   2340
   ClientWidth     =   5376
   BeginProperty Font 
      Name            =   "宋体"
      Size            =   10.8
      Charset         =   134
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   ScaleHeight     =   3696
   ScaleWidth      =   5376
   Begin VB.CommandButton CmdCancel 
      Caption         =   "取消"
      Height          =   495
      Left            =   3720
      TabIndex        =   4
      Top             =   1920
      Width           =   1215
   End
   Begin VB.CommandButton CmdDelete 
      Caption         =   "删除"
      Enabled         =   0   'False
      Height          =   495
      Left            =   3720
      TabIndex        =   3
      Top             =   1200
      Width           =   1215
   End
   Begin VB.CommandButton CmdAdd 
      Caption         =   "添加"
      Enabled         =   0   'False
      Height          =   495
      Left            =   3720
      TabIndex        =   2
      Top             =   360
      Width           =   1215
   End
   Begin VB.TextBox TxtRoomType 
      Height          =   375
      Left            =   1320
      TabIndex        =   0
      Top             =   360
      Width           =   2055
   End
   Begin VB.ListBox LstRoomType 
      Height          =   2424
      ItemData        =   "FrmSetRoomType.frx":0000
      Left            =   1320
      List            =   "FrmSetRoomType.frx":0002
      TabIndex        =   1
      Top             =   840
      Width           =   2055
   End
   Begin VB.Label Label2 
      Caption         =   "房间类型列表"
      Height          =   1455
      Left            =   840
      TabIndex        =   6
      Top             =   1320
      Width           =   375
   End
   Begin VB.Label Label1 
      Caption         =   "房间类型"
      Height          =   375
      Left            =   240
      TabIndex        =   5
      Top             =   360
      Width           =   1095
   End
End
Attribute VB_Name = "FrmSetRoomType"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Function RoomType_Del(pRoomType As String) As Boolean
    Dim sTmp  As String
    On Error GoTo ErrHand:
       sTmp = "RoomType='" & pRoomType & "'"
       With RC_RoomType
           If Not (.BOF And .EOF) Then
              .MoveFirst
              .FindLast sTmp
              If Not .NoMatch Then
                 .Delete
                 RoomType_Del = True
                 Exit Function
              End If
            End If
        End With
         RoomType_Del = False
        Exit Function
ErrHand:
        RoomType_Del = False
End Function
Private Sub CmdAdd_Click()
    If TxtRoomType.Text = "" Then
          MsgBox "房间类型非空", vbInformation + vbOKOnly, "提示"
          Exit Sub
       Else
          If RoomType_Add(TxtRoomType.Text) Then
             LstRoomType.AddItem TxtRoomType.Text, 0
             CmdAdd.Enabled = False
             Call RC_EventLog_Add("添加房间类型" & TxtRoomType.Text, gUserName, "")
            Else
             MsgBox "该房间类型已经存在!", vbInformation + vbOKOnly, "提示"
          End If
          TxtRoomType.Text = ""
     End If
End Sub

Function RoomType_Add(pRoomType As String) As Boolean
    Dim sTmp  As String
    On Error GoTo ErrHand:
       sTmp = "RoomType='" & pRoomType & "'"
       With RC_RoomType
           If Not (.BOF And .EOF) Then
              .MoveFirst
              .FindLast sTmp
              If Not .NoMatch Then
                 RoomType_Add = False
                 Exit Function
              End If
            End If
            .AddNew
            .Fields("RoomType") = pRoomType
            .Update
        End With
        RoomType_Add = True
        Exit Function
ErrHand:
        RoomType_Add = False
End Function

Private Sub CmdCancel_Click()
     Unload Me
End Sub

Private Sub CmdDelete_Click()
    Dim sTmp As String
        If LstRoomType.Text <> "" Then
          If RoomType_Del(LstRoomType.Text) Then
             Call RC_EventLog_Add("添加房间类型" & LstRoomType.Text, gUserName, "")
             LstRoomType.RemoveItem (LstRoomType.ListIndex)
             CmdDelete.Enabled = False
          End If
     End If
End Sub

Private Sub Form_Load()
    With RC_RoomType
      If Not (.EOF And .BOF) Then
        .MoveFirst
        While Not .EOF
            LstRoomType.AddItem Trim(.Fields("roomtype"))
            .MoveNext
        Wend
      End If
    End With
End Sub

Private Sub LstRoomType_Click()
    CmdDelete.Enabled = True
End Sub

Private Sub TxtRoomType_Change()
    CmdAdd.Enabled = True
End Sub

⌨️ 快捷键说明

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