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

📄 frmtemplate.frm

📁 一个功能比较完善的远程抄表软件
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmTemplate 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "用户设备设置模板"
   ClientHeight    =   1920
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   5835
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   1920
   ScaleWidth      =   5835
   Begin VB.ListBox lstName 
      Columns         =   2
      Height          =   1320
      Left            =   0
      TabIndex        =   3
      Top             =   480
      Width           =   5775
   End
   Begin VB.TextBox txtName 
      Height          =   285
      Left            =   960
      TabIndex        =   2
      Top             =   120
      Width           =   2535
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "确定 "
      Default         =   -1  'True
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      Left            =   3600
      TabIndex        =   1
      Top             =   120
      Width           =   975
   End
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      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          =   315
      Left            =   4680
      TabIndex        =   0
      Top             =   120
      Width           =   975
   End
   Begin VB.Label Label1 
      Caption         =   "模板名称:"
      Height          =   255
      Left            =   120
      TabIndex        =   4
      Top             =   120
      Width           =   855
   End
End
Attribute VB_Name = "frmTemplate"
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
'          如果您有新的好的代码别忘记给枕善居哦!
'****************************************************************************

Private Sub Command2_Click()
    Unload frmTemplate
End Sub

Private Sub cmdCancel_Click()
    Unload Me
End Sub

Private Sub cmdOK_Click()
Dim curTemplateName As String
Dim rcTemplate As Recordset
    
    curTemplateName = Trim(txtName.Text)
    Set rcTemplate = dbCbb.OpenRecordset("Template", dbOpenDynaset)
    Select Case TemplateType
        Case 1
'status
            AppendStatusInfo "保存用户设备设置模板", icoBLUE
            SaveLog "保存用户设备设置模板", 0
            rcTemplate.FindFirst "Name=""" + curTemplateName + """"
            If Not rcTemplate.NoMatch Then
                If MsgBox("该模板已经存在" + Chr(10) + "确定要覆盖原模板内容吗?", 48 + 1, "保存模板") = 2 Then
                    Exit Sub
                End If
                Do While Not rcTemplate.NoMatch
                    rcTemplate.Delete
                    If Not rcTemplate.EOF Then
                        rcTemplate.FindNext "Name=""" + curTemplateName + """"
                    Else
                        Exit Do
                    End If
                Loop
            End If
            If frmUserDev1.datUserDev.Recordset.RecordCount > 0 Then
                frmUserDev1.datUserDev.Recordset.MoveFirst
                Do While Not frmUserDev1.datUserDev.Recordset.EOF
                    rcTemplate.AddNew
                    rcTemplate!Name = curTemplateName
                    rcTemplate!devID = frmUserDev1.datUserDev.Recordset!devID
                    rcTemplate!DevType = frmUserDev1.datUserDev.Recordset!DevType
                    rcTemplate.Update
                    frmUserDev1.datUserDev.Recordset.MoveNext
                Loop
            End If
        Case 2
'status
            AppendStatusInfo "以用户设备模板设置", icoBLUE
            SaveLog "以用户设备模板设置", 0
            rcTemplate.FindFirst "Name=""" + curTemplateName + """"
            If rcTemplate.NoMatch Then
'status
                AppendStatusInfo "找不到指定的模板", icoBLUE
                SaveLog "找不到指定的模板", 0
               MsgBox "找不到指定的模板", 48, "以模板设置"
               Exit Sub
            End If
            
            SQL = "delete * from temuserdev"
            dbCbb.Execute SQL
            SQL = "insert into temuserdev "
            SQL = SQL + "select devID,devType "
            SQL = SQL + "from template "
            SQL = SQL + "where trim(name)=""" + curTemplateName + """"
            dbCbb.Execute SQL
            
            frmUserDev1.datUserDev.Refresh
    End Select
    Unload frmTemplate
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
    


Dim rcTemplate As Recordset

    Select Case TemplateType
        Case 1
            frmTemplate.Caption = "保存模板为..."
        Case 2
            frmTemplate.Caption = "设置模板为..."
    End Select
    
    SQL = "select distinct name "
    SQL = SQL + "from Template"
    Set rcTemplate = dbCbb.OpenRecordset(SQL, dbOpenDynaset)
    If Not rcTemplate.EOF Then
        rcTemplate.MoveFirst
        Do While Not rcTemplate.EOF
            lstName.AddItem rcTemplate!Name
            rcTemplate.MoveNext
        Loop
    End If
    rcTemplate.Close
    Set rcTemplate = Nothing
    
    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 lstName_Click()
    txtName.Text = lstName.List(lstName.ListIndex)
    txtName.SetFocus
End Sub


Private Sub lstName_DblClick()
    txtName.Text = lstName.List(lstName.ListIndex)
    cmdOK_Click
End Sub


Private Sub txtName_GotFocus()
    txtName.SelStart = 0
    txtName.SelLength = Len(Trim(txtName.Text))
    txtName.Refresh
End Sub



⌨️ 快捷键说明

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