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

📄 dlgadditem.frm

📁 opc的使用软件
💻 FRM
字号:
VERSION 5.00
Begin VB.Form dlgAddItem 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Add OPC Item"
   ClientHeight    =   3030
   ClientLeft      =   2760
   ClientTop       =   3750
   ClientWidth     =   5760
   Icon            =   "dlgAddItem.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3030
   ScaleWidth      =   5760
   ShowInTaskbar   =   0   'False
   Begin VB.ListBox listItem 
      Height          =   2220
      Left            =   1080
      TabIndex        =   3
      Top             =   720
      Width           =   3015
   End
   Begin VB.TextBox txtItemName 
      Height          =   375
      Left            =   1080
      TabIndex        =   2
      Top             =   120
      Width           =   3015
   End
   Begin VB.CommandButton CancelButton 
      Caption         =   "&Cancel"
      Height          =   375
      Left            =   4440
      TabIndex        =   1
      Top             =   600
      Width           =   1215
   End
   Begin VB.CommandButton OKButton 
      Caption         =   "&OK"
      Default         =   -1  'True
      Height          =   375
      Left            =   4440
      TabIndex        =   0
      Top             =   120
      Width           =   1215
   End
   Begin VB.Label Label2 
      Caption         =   "Item List"
      Height          =   375
      Left            =   120
      TabIndex        =   5
      Top             =   720
      Width           =   975
   End
   Begin VB.Label Label1 
      Caption         =   "Item Name"
      Height          =   375
      Left            =   120
      TabIndex        =   4
      Top             =   240
      Width           =   975
   End
End
Attribute VB_Name = "dlgAddItem"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Option Explicit
Public mbReturn As Boolean
Public mstrName As String


Private Sub CancelButton_Click()
    Unload Me
End Sub

Private Sub Form_Load()
    mbReturn = False

    Dim i, j, k As Integer
    i = KOC_GetItemCount(gConnectionHandle)
    If i = -1 Then
        MsgBox "error getting item list!"
        Exit Sub
    End If
    
    Dim buf(100) As Byte
    Dim br As Boolean
    Dim sName As String
    For j = 0 To i - 1
        br = KOC_GetItemName(gConnectionHandle, j, buf(0), 100)
        If br = True Then
            sName = ""
            For k = 0 To 99
                sName = sName + Chr(buf(k))
            Next k
            listItem.AddItem sName
        End If
    Next j
End Sub

Private Sub listItem_Click()
    If listItem.ListIndex = -1 Then Exit Sub
    
    txtItemName.Text = listItem.Text
End Sub

Private Sub OKButton_Click()
    mstrName = txtItemName.Text
    If Len(mstrName) < 1 Then
        MsgBox "Item name is empty!"
        Exit Sub
    End If
    mbReturn = True
    Unload Me
End Sub

⌨️ 快捷键说明

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