Executing a Tag Command from VB.NET Code

Introduction

The following code fragment shows how to execute a tag command from a VB Program:

Module TestSample

    Sub Main()

        ' Allocate a new connection
        Dim connection As New Connection()

        ' Connect to Fernhill SCADA
        ' Note: This version of Connect uses integrated windows security where
        ' the Fernhill SCADA Server will automatically obtain an access token
        ' from the client's login.
        connection.Connect("localhost")

        ' The tagCommand() function Is used to execute any tag command.  
        ' You must pass at least two parameters:
        '  1) The tag's full name, in this example: TestFolder.DigitalTag
        '  2) The tag command to execute.  In this example: WriteValue
        ' The remaining parameters depend on the tag command.  This example uses WriteValue,
        ' which requires one extra parameter - the value to write.
        connection.TagCommand("Test.Digital Tag", "WriteValue", True)

        ' Close the connection
        connection.Disconnect()

    End Sub
End Module

Further Information

Connection class

To learn about the Java API Connection class.

Connection.tagCommand() function

To learn about the Java API tagCommand() function in the Connection class.