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 WriteValueToTag

    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 login credentials of the client.
        connection.Connect("localhost")

        ' The tagCommand() function Is used to execute any tag command.  
        ' You must pass at least two parameters:
        '  1) The full name of the tag, 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("TestFolder.DigitalTag", "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.