frmhoname.frm

来自「星级酒店客房管理系统一套很不错的系统」· FRM 代码 · 共 226 行

FRM
226
字号
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form FrmHoName 
   Caption         =   "定义本单位名称"
   ClientHeight    =   3060
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   6060
   Icon            =   "FrmHoName.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   3060
   ScaleWidth      =   6060
   StartUpPosition =   1  '所有者中心
   Begin VB.TextBox Text1 
      Appearance      =   0  'Flat
      Height          =   270
      Index           =   5
      Left            =   2040
      TabIndex        =   9
      Top             =   2640
      Width           =   2500
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   375
      Left            =   4800
      Top             =   840
      Visible         =   0   'False
      Width           =   1200
      _ExtentX        =   2117
      _ExtentY        =   661
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.CommandButton Command2 
      Caption         =   "返回"
      Height          =   375
      Left            =   4920
      TabIndex        =   8
      Top             =   2160
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "设置"
      Height          =   375
      Left            =   4920
      TabIndex        =   7
      Top             =   1680
      Width           =   975
   End
   Begin VB.TextBox Text1 
      Appearance      =   0  'Flat
      Height          =   270
      Index           =   4
      Left            =   2040
      TabIndex        =   6
      Top             =   2280
      Width           =   2500
   End
   Begin VB.TextBox Text1 
      Appearance      =   0  'Flat
      Height          =   270
      Index           =   3
      Left            =   2040
      TabIndex        =   5
      Top             =   1920
      Width           =   2500
   End
   Begin VB.TextBox Text1 
      Appearance      =   0  'Flat
      Height          =   270
      Index           =   2
      Left            =   2040
      TabIndex        =   4
      Top             =   1560
      Width           =   2500
   End
   Begin VB.TextBox Text1 
      Appearance      =   0  'Flat
      Height          =   270
      Index           =   1
      Left            =   2040
      TabIndex        =   3
      Top             =   1200
      Width           =   2500
   End
   Begin VB.TextBox Text1 
      Appearance      =   0  'Flat
      Height          =   270
      Index           =   0
      Left            =   2040
      TabIndex        =   2
      Top             =   840
      Width           =   2500
   End
   Begin VB.Label Label2 
      BackStyle       =   0  'Transparent
      Caption         =   "酒店名称:           电    话:           地    址:           开户银行:           银行帐号:           网    址:"
      Height          =   2295
      Left            =   960
      TabIndex        =   1
      Top             =   840
      Width           =   975
   End
   Begin VB.Image Image1 
      Height          =   480
      Left            =   240
      Picture         =   "FrmHoName.frx":1982
      Top             =   120
      Width           =   480
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "所定义名称将有可能被用于票据打印条目上,请填写正确的酒店名称(比如:中旭大酒店)."
      ForeColor       =   &H000000C0&
      Height          =   495
      Left            =   960
      TabIndex        =   0
      Top             =   240
      Width           =   4695
   End
End
Attribute VB_Name = "FrmHoName"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public flag As Boolean
Private Sub Command1_Click()
Select Case Command1.Caption
Case "设置"
flag = True
  For i = 1 To Text1.Count
        Text1(i - 1).Enabled = True
        Text1(i - 1).Text = ""
Next
Text1(0).SetFocus
Command1.Caption = "保存"
Case "修改"
For i = 1 To Text1.Count
Text1(i - 1).Enabled = True
Next
Command1.Caption = "保存"
flag = True
Case "保存"
For i = 1 To Text1.Count
If Len(Text1(i - 1).Text) = 0 Then flag = False
Next
If flag = True Then
Adodc1.Recordset.Fields("name").Value = Trim(Text1(0).Text)
Adodc1.Recordset.Fields("tel").Value = Trim(Text1(1).Text)
Adodc1.Recordset.Fields("add").Value = Trim(Text1(2).Text)
Adodc1.Recordset.Fields("bank").Value = Trim(Text1(3).Text)
Adodc1.Recordset.Fields("bankNO").Value = Trim(Text1(4).Text)
Adodc1.Recordset.Fields("website").Value = Trim(Text1(5).Text)
Adodc1.Recordset.Update
Unload Me
Else
MsgBox "请填写完整信息!", vbOKOnly, "提示"
End If
End Select
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Form_Load()
  Adodc1.ConnectionString = My_PROVIDER
    Adodc1.CommandType = adCmdText
    Adodc1.RecordSource = "select * from 本单位定义"
    Adodc1.Refresh
    For i = 1 To Text1.Count
        Text1(i - 1).Enabled = False
    Next
    If Adodc1.Recordset.RecordCount > 0 Then
    Command1.Caption = "修改"
    Text1(0).Text = Adodc1.Recordset.Fields("name").Value
    Text1(1).Text = Adodc1.Recordset.Fields("tel").Value
    Text1(2).Text = Adodc1.Recordset.Fields("add").Value
    Text1(3).Text = Adodc1.Recordset.Fields("bank").Value
    Text1(4).Text = Adodc1.Recordset.Fields("bankNO").Value
    Text1(5).Text = Adodc1.Recordset.Fields("website").Value
    Else
    MsgBox "您还没有定义单位信息,请填写!", vbOKOnly, "提示!"
    Command1.Caption = "设置"
    Adodc1.Recordset.AddNew
    End If
End Sub

⌨️ 快捷键说明

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