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

📄 frmusefittings.frm

📁 一个vb编的计算机机房管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmUseFittings 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "领用&归还"
   ClientHeight    =   4410
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   5280
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   4410
   ScaleWidth      =   5280
   Begin VB.Frame Frame1 
      Height          =   3495
      Left            =   480
      TabIndex        =   3
      Top             =   120
      Width           =   4335
      Begin VB.OptionButton optType 
         Caption         =   "归还"
         Height          =   375
         Index           =   1
         Left            =   2760
         TabIndex        =   14
         Top             =   360
         Width           =   735
      End
      Begin VB.OptionButton optType 
         Caption         =   "领用"
         Height          =   375
         Index           =   0
         Left            =   1800
         TabIndex        =   13
         Top             =   360
         Value           =   -1  'True
         Width           =   855
      End
      Begin VB.TextBox txtFName 
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   1800
         MaxLength       =   10
         TabIndex        =   7
         Top             =   840
         Width           =   1575
      End
      Begin VB.TextBox txtBrand 
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   1800
         MaxLength       =   20
         TabIndex        =   6
         Top             =   1320
         Width           =   1575
      End
      Begin VB.TextBox txtFType 
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   1800
         MaxLength       =   15
         TabIndex        =   5
         Top             =   1800
         Width           =   1575
      End
      Begin VB.TextBox txtFCount 
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   1800
         MaxLength       =   9
         TabIndex        =   4
         Top             =   2280
         Width           =   1575
      End
      Begin VB.Label Label2 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H80000005&
         BackStyle       =   0  'Transparent
         Caption         =   "操作:"
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   14.25
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   285
         Left            =   840
         TabIndex        =   12
         Top             =   360
         Width           =   945
      End
      Begin VB.Label Label1 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H80000005&
         BackStyle       =   0  'Transparent
         Caption         =   "名称:"
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   14.25
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   285
         Left            =   840
         TabIndex        =   11
         Top             =   840
         Width           =   945
      End
      Begin VB.Label Label3 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H80000005&
         BackStyle       =   0  'Transparent
         Caption         =   "品牌:"
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   14.25
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   285
         Left            =   840
         TabIndex        =   10
         Top             =   1320
         Width           =   945
      End
      Begin VB.Label Label4 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H80000005&
         BackStyle       =   0  'Transparent
         Caption         =   "型号:"
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   14.25
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   285
         Left            =   840
         TabIndex        =   9
         Top             =   1800
         Width           =   945
      End
      Begin VB.Label Label6 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H80000005&
         BackStyle       =   0  'Transparent
         Caption         =   "数量:"
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   14.25
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   285
         Left            =   840
         TabIndex        =   8
         Top             =   2280
         Width           =   945
      End
   End
   Begin VB.CommandButton cmdSearch 
      Caption         =   "查询"
      Height          =   375
      Left            =   2160
      TabIndex        =   2
      Top             =   3840
      Width           =   975
   End
   Begin VB.CommandButton cmdCancel 
      Caption         =   "取消"
      Height          =   375
      Left            =   3840
      TabIndex        =   1
      Top             =   3840
      Width           =   975
   End
   Begin VB.CommandButton cmdAdd 
      Caption         =   "确定"
      Height          =   375
      Left            =   480
      TabIndex        =   0
      Top             =   3840
      Width           =   975
   End
End
Attribute VB_Name = "frmUseFittings"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

' FNAME Not VarChar(20), --配件名称
' BRAND VarChar(40), --品牌
' FTYPE Not VarChar(30), --型号
' PRICE Not Money, --价格
' FCOUNT INT NOT NULL,   --数量
' STOREID VARCHAR(30))   --存储地点,但个字符表示仓库,其他表示地点

Private objFittings As New fittings


Private Sub cmdAdd_Click()
    If checkForm() = True Then
        Call getFormValues
    '添加内容到数据库
        If Me.optType.Item(0).Value = True Then
        '领用
            If objFittings.Use() Then
                MsgBox "成功领用!"
                Call resetForm(Me)
                Exit Sub
            Else
                MsgBox "领用失败!"
                Call resetForm(Me)
                Exit Sub
            End If
        Else
        '归还
            If objFittings.ReturnBack() Then
                MsgBox "成功归还!"
                Call resetForm(Me)
                Exit Sub
            Else
                MsgBox "归还失败!"
                Call resetForm(Me)
                Exit Sub
            End If
        End If
    End If
End Sub

Private Sub cmdCancel_Click()
    Unload Me
End Sub

Private Sub cmdSearch_Click()
    Dim rsS As ADODB.Recordset
    Dim strCondition As String
    
    
    If Me.txtFName.Text = "" Then
        MsgBox "配件名称不能为空!"
        Me.txtFName.SetFocus
        Exit Sub
    End If
    If Me.txtBrand.Text = "" Then
        MsgBox "配件品牌不能为空!"
        Me.txtBrand.SetFocus
        Exit Sub
    End If
    If Me.txtFType.Text = "" Then
        MsgBox "配件型号不能为空!"
        Me.txtFType.SetFocus
        Exit Sub
    End If
    
    objFittings.fname = Me.txtFName.Text
    objFittings.brand = Me.txtBrand.Text
    objFittings.ftype = Me.txtFType.Text
    
    strCondition = "fname='" & objFittings.fname & "' and FTYPE = '" & objFittings.ftype & "' and brand='" & objFittings.brand & "'"
    Set rsS = objDBOpt.getRecord("fittings", "*", strCondition)
    If rsS Is Nothing Then
        MsgBox "数据查询失败!"
        Exit Sub
    End If
    If rsS.EOF And rsS.BOF Then
        MsgBox "没有符合条件的数据!"
        rsS.Close
        Exit Sub
    End If
    Me.txtFName.Text = setNotNull(rsS.Fields("fname").Value)
    Me.txtBrand.Text = setNotNull(rsS.Fields("brand").Value)
    Me.txtFType.Text = setNotNull(rsS.Fields("ftype").Value)
    Me.txtFCount.Text = setNotNull(rsS.Fields("fcount").Value)
    
    rsS.Close
End Sub

Private Sub Form_Load()
    Call resetForm(Me)
End Sub
Private Sub getFormValues()
'将页面输入框中的值读入到类属性中
    
    objFittings.fname = Trim(Me.txtFName.Text)
    objFittings.brand = Trim(Me.txtBrand.Text)
    objFittings.ftype = Trim(Me.txtFType.Text)
    objFittings.fcount = Trim(Me.txtFCount.Text)
    
End Sub
Private Function checkForm() As Boolean
    If Me.txtFName.Text = "" Then
        MsgBox "配件名称不能为空!"
        Me.txtFName.SetFocus
        checkForm = False
        Exit Function
    End If
    If Me.txtBrand.Text = "" Then
        MsgBox "配件品牌不能为空!"
        Me.txtBrand.SetFocus
        checkForm = False
        Exit Function
    End If
    If Me.txtFType.Text = "" Then
        MsgBox "配件型号不能为空!"
        Me.txtFType.SetFocus
        checkForm = False
        Exit Function
    End If
    
    If Me.txtFCount.Text = "" Then
        MsgBox "配件数量不能为空!"
        Me.txtFCount.SetFocus
        checkForm = False
        Exit Function
    End If
    If Not (IsNumeric(Me.txtFCount.Text) And (InStr(1, CStr(Me.txtFCount.Text), ".", vbTextCompare) < 1) And (InStr(1, CStr(Me.txtFCount.Text), "-", vbTextCompare) < 1)) Then
        MsgBox "配件数量应该为数字!"
        Me.txtFCount.SetFocus
        checkForm = False
        Exit Function
    End If
    checkForm = True
End Function

⌨️ 快捷键说明

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