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

📄 simplereadwrite.frm

📁 opc code,with visual badic
💻 FRM
字号:
VERSION 5.00
Object = "{7664C9DF-EA9A-48A0-BBCE-BD61A51213DD}#2.0#0"; "opcdatx.ocx"
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   3645
   ClientLeft      =   45
   ClientTop       =   270
   ClientWidth     =   5385
   LinkTopic       =   "Form1"
   ScaleHeight     =   3645
   ScaleWidth      =   5385
   StartUpPosition =   3  'Windows Default
   Begin VB.TextBox Text3 
      Height          =   420
      Left            =   756
      TabIndex        =   3
      Top             =   1824
      Width           =   2064
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Write Value"
      Height          =   456
      Left            =   1104
      TabIndex        =   2
      Top             =   1236
      Width           =   1404
   End
   Begin VB.TextBox Text2 
      Height          =   384
      Left            =   744
      TabIndex        =   1
      Text            =   "Text2"
      Top             =   576
      Width           =   2076
   End
   Begin VB.TextBox Text1 
      Height          =   396
      Left            =   756
      TabIndex        =   0
      Text            =   "Text1"
      Top             =   120
      Width           =   2064
   End
   Begin OPCDATALib.OPCData OPCData1 
      Left            =   3600
      Top             =   240
      _Version        =   131072
      _ExtentX        =   661
      _ExtentY        =   714
      _StockProps     =   0
      MultipleEngines =   0   'False
      TagSource       =   ""
      PCName          =   ""
      OPCServer       =   "OPCDataCtrl.OPCSimServer.1"
      ConnectionTable =   ""
      CtrlTable       =   ""
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
    'Declare some variables - good programming practice
    Dim result As Long
    Dim Tagname As String
    Dim Timeout As Long
    
    'Set the full OPC item path and tagname in the OPC server to write to
    'Note this will vary from one OPC server to another -- a simple
    'way to tell is to use the OPC data control to browse to the item
    'as if you were going to read it and capture the pathname shown there
    'the same path that can be used to read a tag will be used to write it
    Tagname = "Tank1.Sp"
    Timeout = 100 'Set the command timeout in ms
    
    'write the data - result=0 is a success
    result = OPCData1.WriteVariable(Tagname, Text3.Text, Timeout)
End Sub

⌨️ 快捷键说明

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