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

📄 frmdevset.frm

📁 CBB摄像直读远传抄表系统 Ver 5.2
💻 FRM
字号:
VERSION 5.00
Object = "{00028C01-0000-0000-0000-000000000046}#1.0#0"; "DBGRID32.OCX"
Begin VB.Form frmDevSet 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "网络设备设置"
   ClientHeight    =   3375
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   5415
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   3375
   ScaleWidth      =   5415
   Begin VB.Data datDev 
      Connect         =   "Access"
      DatabaseName    =   ""
      DefaultCursorType=   0  '缺省游标
      DefaultType     =   2  '使用 ODBC
      Exclusive       =   0   'False
      Height          =   345
      Left            =   2790
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   "DevsMap"
      Top             =   2535
      Width           =   2520
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "确定 "
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   348
      Left            =   2700
      TabIndex        =   2
      Top             =   2970
      Width           =   1215
   End
   Begin VB.CommandButton cmdCancel 
      Caption         =   "取消 "
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   348
      Left            =   4020
      TabIndex        =   1
      Top             =   2970
      Width           =   1215
   End
   Begin VB.ComboBox cmbBit 
      Height          =   300
      Left            =   1680
      Style           =   2  'Dropdown List
      TabIndex        =   0
      Top             =   2550
      Width           =   855
   End
   Begin MSDBGrid.DBGrid grdDev 
      Bindings        =   "frmDevSet.frx":0000
      Height          =   2415
      Left            =   120
      OleObjectBlob   =   "frmDevSet.frx":0015
      TabIndex        =   3
      Top             =   120
      Width           =   5190
   End
   Begin VB.Label Label1 
      Caption         =   "网络设备数据位:"
      Height          =   255
      Left            =   225
      TabIndex        =   5
      Top             =   2595
      Width           =   1380
   End
   Begin VB.Label Label2 
      Caption         =   "位"
      Height          =   255
      Left            =   2550
      TabIndex        =   4
      Top             =   2595
      Width           =   255
   End
End
Attribute VB_Name = "frmDevSet"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'****************************************************************************
'人人为我,我为人人
'枕善居收藏整理
'发布日期:2007/07/09
'描    述:CBB三表户外计量系统 Ver 5.2
'网    站:http://www.Mndsoft.com/  (VB6源码博客)
'网    站:http://www.VbDnet.com/   (VB.NET源码博客,主要基于.NET2005)
'e-mail  :Mndsoft@163.com
'e-mail  :Mndsoft@126.com
'OICQ    :88382850
'          如果您有新的好的代码别忘记给枕善居哦!
'****************************************************************************
Dim errMsg As String
Function chkValid() As Boolean
    chkValid = True
    errMsg = ""
'    datDev.Refresh
    
    datDev.Recordset.FindFirst "isnull(TypeID)"
    If Not datDev.Recordset.NoMatch Then
        errMsg = errMsg + "存在还未设置的空设备类型号" + Chr(10)
        chkValid = False
    End If
    
    datDev.Recordset.FindFirst "isnull(Name)"
    Do While Not datDev.Recordset.NoMatch
        datDev.Recordset.Edit
        datDev.Recordset!Name = ""
        datDev.Recordset.Update
        datDev.Recordset.FindNext "isnull(Name)"
    Loop
    datDev.Recordset.FindFirst "isnull(Price)"
    Do While Not datDev.Recordset.NoMatch
        datDev.Recordset.Edit
        datDev.Recordset!Price = 0
        datDev.Recordset.Update
        datDev.Recordset.FindNext "isnull(Price)"
    Loop
End Function


Private Sub cmdCancel_Click()
    dbCbb.Rollback
    Unload frmDevSet
End Sub

Private Sub cmdOK_Click()
    errMsg = ""
    If (Not chkValid) And errMsg <> "" Then
        MsgBox errMsg, 48, "设备设置错误"
        Exit Sub
    End If
    
'Dim rcBit As Recordset
'    Set rcBit = dbCbb.OpenRecordset("Bit", dbOpenDynaset)
    curBit = Val(Trim(cmbBit.List(cmbBit.ListIndex)))
'    If rcBit.RecordCount <= 0 Then
'        rcBit.AddNew
'        rcBit!BitType = curBit
'        rcBit.Update
'    Else
'        rcBit.MoveFirst
'        rcBit.Edit
'        rcBit!BitType = curBit
'        rcBit.Update
'    End If
'    rcBit.Close
    
    dbCbb.CommitTrans
'status
    AppendStatusInfo "修改网络设备设置", icoBLUE
    SaveLog "修改网络设备设置", 0
    
    SaveINI
    Unload frmDevSet
End Sub



Private Sub datDev_Reposition()
    If Not datDev.Recordset.EOF Then
        If IsNull(datDev.Recordset!Name) Then
            datDev.Caption = ""
        Else
            datDev.Caption = datDev.Recordset!Name
        End If
    End If
End Sub

Private Sub Form_Load()
    If UBound(curForm) > 0 Then
        curForm(UBound(curForm)).Enabled = False
    End If
    ReDim Preserve curForm(UBound(curForm) + 1)
    Set curForm(UBound(curForm)) = Me
    

    datDev.DatabaseName = App.Path & "\data\cbb.mdb"
'Dim rcBit As Recordset

'    Set rcBit = dbCbb.OpenRecordset("Bit", dbOpenDynaset)
'    If rcBit.RecordCount <= 0 Then
'        rcBit.AddNew
'        rcBit!BitType = 4
'        rcBit.Update
'    End If
'    curBit = rcBit!BitType
'    rcBit.Close
    
    cmbBit.Clear
    cmbBit.AddItem Format(4)
    cmbBit.AddItem Format(5)
    cmbBit.Refresh
    Select Case curBit
        Case 4
            cmbBit.ListIndex = 0
        Case 5
            cmbBit.ListIndex = 1
    End Select
'status
    AppendStatusInfo "查看网络设备设置", icoBLUE
    SaveLog "查看网络设备设置", 0
    
    dbCbb.BeginTrans
    DoEvents
End Sub


Private Sub Form_Unload(Cancel As Integer)
    ReDim Preserve curForm(UBound(curForm) - 1)
    If UBound(curForm) > 0 Then
        curForm(UBound(curForm)).Enabled = True
    End If

End Sub

Private Sub grdDev_BeforeColUpdate(ByVal ColIndex As Integer, OldValue As Variant, Cancel As Integer)
Dim curAdd As Integer
Dim curFrame As Integer
Dim rcChkGate As Recordset

    Select Case ColIndex
        Case 0            '检查设备类型号
            If Not IsNumeric(grdDev.Columns(0).Value) Then
                MsgBox "设备类型号必须为整数", 48, "设备设置"
                Cancel = True
                Exit Sub
            End If
        Case 1           '检查设备名称
            If Len(grdDev.Columns(1).Value) > 20 Then
                MsgBox "设备名称不能超过20个字符", 48, "设备设置"
                Cancel = True
                Exit Sub
            End If
        Case 2      '检查单价
            If Not IsNumeric(grdDev.Columns(2).Value) Then
                MsgBox "设备单价必须为数字"
                Cancel = True
                Exit Sub
            End If
    End Select
End Sub


⌨️ 快捷键说明

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