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

📄 form51.frm

📁 华城酒店管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form Form5 
   BorderStyle     =   4  'Fixed ToolWindow
   Caption         =   "房间消费品录入"
   ClientHeight    =   3735
   ClientLeft      =   45
   ClientTop       =   315
   ClientWidth     =   3900
   LinkTopic       =   "Form5"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3735
   ScaleWidth      =   3900
   ShowInTaskbar   =   0   'False
   StartUpPosition =   1  '所有者中心
   Begin VB.CommandButton Command5 
      Enabled         =   0   'False
      Height          =   615
      Left            =   240
      Picture         =   "Form51.frx":0000
      Style           =   1  'Graphical
      TabIndex        =   8
      Top             =   1920
      Width           =   375
   End
   Begin MSFlexGridLib.MSFlexGrid Grid1 
      Height          =   1695
      Left            =   120
      TabIndex        =   6
      Top             =   120
      Width           =   2535
      _ExtentX        =   4471
      _ExtentY        =   2990
      _Version        =   393216
      FormatString    =   "消 费 品 名 称| 单 价"
   End
   Begin VB.TextBox txtfield 
      Height          =   375
      Index           =   1
      Left            =   1320
      TabIndex        =   5
      Top             =   2640
      Width           =   2415
   End
   Begin VB.CommandButton Command4 
      Caption         =   "单价"
      Height          =   375
      Left            =   600
      TabIndex        =   4
      Top             =   2640
      Width           =   735
   End
   Begin VB.CommandButton Command3 
      Caption         =   "名称"
      Height          =   375
      Left            =   600
      TabIndex        =   3
      Top             =   2040
      Width           =   735
   End
   Begin VB.CommandButton Command2 
      Caption         =   "退出"
      Height          =   375
      Left            =   2760
      TabIndex        =   2
      Top             =   3240
      Width           =   855
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确定添加"
      Height          =   375
      Left            =   1080
      TabIndex        =   1
      Top             =   3240
      Width           =   1335
   End
   Begin VB.TextBox txtfield 
      Height          =   375
      Index           =   0
      Left            =   1320
      TabIndex        =   0
      Top             =   2040
      Width           =   2415
   End
   Begin VB.Label Label1 
      Caption         =   "双击表格中的消费品名称可以进行删除该条记录的操作!"
      ForeColor       =   &H000000FF&
      Height          =   1335
      Left            =   2760
      TabIndex        =   7
      Top             =   120
      Width           =   855
   End
End
Attribute VB_Name = "Form5"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Form_Load()
'retValue = SetWindowPos(Me.hwnd, HWND_TOPMOST, Me.CurrentX, Me.CurrentY, 11880, 8280, SWP_SHOWWINDOW)
 
 SaIt
End Sub





Private Sub Grid1_DblClick()
Dim db As Database
  Dim EF As Recordset
  Set db = OpenDatabase(ConData, 0, 0, Constr)
  Set EF = db.OpenRecordset("select * from wp where 名称='" & Grid1.Text & "'", dbOpenDynaset)
  
  
  
     '列出记录
      If Not (EF.BOF And EF.EOF) Then
         Do While Not EF.EOF
            EF.Delete
            
            EF.MoveNext
         Loop
      End If
      
 '添加合计
  
  'Grid1.Row = Grid1.Rows - 1
  'Dim X As Integer
     ' For X = 7 To 0 Step -1
        ' Grid1.Col = X
        ' Grid1.CellBackColor = &HE0E0D0
     ' Next
 ' Grid1.ColSel = 7
  
  EF.Close
  db.Close
  
  SaIt
End Sub

Private Sub txtField_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)

 If KeyCode = 38 Then
    '自动上移
     If Index > 0 Then                   '最后一个文本框
        Txtfield(Index - 1).SetFocus
       Else
        Txtfield(1).SetFocus               '返回
     End If
     Exit Sub
 End If
 
  If KeyCode = 40 Then
    '自动下跳
     If Index < 1 Then                    '最后一个文本框
        Txtfield(Index + 1).SetFocus
       Else
        Txtfield(0).SetFocus               '返回
     End If
     Exit Sub
 End If
 
End Sub

Private Sub txtField_KeyPress(Index As Integer, KeyAscii As Integer)

 If KeyAscii = 13 Then
    '自动下跳
     If Index < 1 Then                    '最后一个文本框
        Txtfield(Index + 1).SetFocus
       Else
        Txtfield(0).SetFocus               '返回
     End If
     Exit Sub
 End If
     
'判断是否为正确输入
 
         
 
 
End Sub

Private Sub Command1_Click()
If Trim(Txtfield(0).Text) = "" Then
      MsgBox "对不起,名称必须输入?   ", vbInformation, "Hello!"
      Txtfield(0).SetFocus
      Exit Sub
   End If
   If Trim(Txtfield(1).Text) = "" Then
      MsgBox "对不起,单价必须输入?   ", vbInformation, "Hello!"
      Txtfield(1).SetFocus
      Exit Sub
   End If
  
   
   
   
 '开始保存内容
   Dim db As Database
  Dim EF As Recordset
  
  Set db = OpenDatabase(ConData, 0, 0, Constr)
  Set EF = db.OpenRecordset("Select * from wp", dbOpenDynaset)
  
     
      '==================1
       If Trim(Txtfield(0).Text) <> "" Then
          EF.AddNew
          EF("名称") = Txtfield(0).Text
          
           
          EF("单价") = Txtfield(1).Text
          
          
          EF.Update
          
          
       End If
      '-----------------2
      
      '-----------------
      
  EF.Close
  db.Close
   
  MsgBox "物品已经录入   ", vbInformation
 For i = 0 To 1
 
  Txtfield(i) = ""
  Next
   SaIt
End Sub

Private Sub Command2_Click()
Unload Me
End Sub
Private Sub SaIt()
Dim db As Database
  Dim EF As Recordset
  Set db = OpenDatabase(ConData, 0, 0, Constr)
  Set EF = db.OpenRecordset("select * from wp ", dbOpenDynaset)
  
  Dim curSumMoney As Currency
  Dim curSumQuanty As Currency
  
      curSumMoney = 0
      curSumQuanty = 0
      Grid1.Rows = 1
  
     '列出记录
      If Not (EF.BOF And EF.EOF) Then
         Do While Not EF.EOF
            Grid1.AddItem EF("名称") & vbTab & EF("单价")
            
            EF.MoveNext
         Loop
      End If
      
 '添加合计
  
  'Grid1.Row = Grid1.Rows - 1
  'Dim X As Integer
     ' For X = 7 To 0 Step -1
        ' Grid1.Col = X
        ' Grid1.CellBackColor = &HE0E0D0
     ' Next
 ' Grid1.ColSel = 7
  
  EF.Close
  db.Close
End Sub

⌨️ 快捷键说明

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