'Usage
Dim instance As _EasyUAClient Dim handle As Integer instance.UnsubscribeMonitoredItem(handle)
Parameters
- handle
- Monitored item subscription handle as returned by the subscription method
Unsubscribe from monitored item, specifying its handle.
'Usage
Dim instance As _EasyUAClient Dim handle As Integer instance.UnsubscribeMonitoredItem(handle)
Exception | Description |
---|---|
System.ArgumentException | One of the arguments provided to a method is not valid. This is a usage error, i.e. it will never occur (the exception will not be thrown) in a correctly written program. Your code should not catch this exception. |
System.ArgumentNullException |
A This is a usage error, i.e. it will never occur (the exception will not be thrown) in a correctly written program. Your code should not catch this exception. |
It is more efficient to unsubscribe from multiple items using the OpcLabs.EasyOpc.UA.IEasyUAClient.UnsubscribeMultipleMonitoredItems method.
The monitored item subscription handle becomes invalid after this method is called.
This member or type is for use from COM. It is not meant to be used from .NET or Python. Refer to the corresponding .NET member or type instead, if you are developing in .NET or Python.
This is an extension method (info: C#, VB.NET). In languages that have support for extensions methods (such as C# and VB.NET), you can use the extension method as if it were a regular method on the object that is its first parameter. In other languages (such as with Python.NET), you will call the extension as a static method, and pass it the object on which it acts as its first parameter.
Rem This example shows how unsubscribe from changes of a single monitored item. Rem Rem Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . Rem OPC client and subscriber examples in VBScript on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-VBScript . Rem Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own Rem a commercial license in order to use Online Forums, and we reply to every post. Option Explicit ' Instantiate the client object and hook events Dim Client: Set Client= CreateObject("OpcLabs.EasyOpc.UA.EasyUAClient") WScript.ConnectObject Client, "Client_" WScript.Echo "Subscribing..." Dim handle: handle = Client.SubscribeDataChange("opc.tcp://opcua.demo-this.com:51210/UA/SampleServer", "nsu=http://test.org/UA/Data/ ;i=10853", 1000) WScript.Echo "Processing monitored item changed events for 10 seconds..." WScript.Sleep 10*1000 WScript.Echo "Unsubscribing..." Client.UnsubscribeMonitoredItem handle WScript.Echo "Waiting for 5 seconds..." WScript.Sleep 5 * 1000 Sub Client_DataChangeNotification(Sender, e) ' Display the data Dim display: If e.Exception Is Nothing Then display = e.AttributeData Else display = e.ErrorMessageBrief WScript.Echo display End Sub