// This example shows how to let the user browse for an OPC-UA data node (a Data Variable or a Property). // // Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . using System.Windows.Forms; using OpcLabs.EasyOpc.UA.Forms.Browsing; namespace UAFormsDocExamples._UADataDialog { static partial class ShowDialog { public static void Main1(IWin32Window owner) { var dataDialog = new UADataDialog { EndpointDescriptor = {UrlString = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer" }, // or "http://opcua.demo-this.com:51211/UA/SampleServer" (currently not supported) // or "https://opcua.demo-this.com:51212/UA/SampleServer/" UserPickEndpoint = true }; DialogResult dialogResult = dataDialog.ShowDialog(owner); if (dialogResult != DialogResult.OK) return; // Display results MessageBox.Show(owner, $"EndpointDescriptor: {dataDialog.EndpointDescriptor}\r\n" + $"NodeElement: {dataDialog.NodeElement}"); } } }
# This example shows how to let the user browse for an OPC-UA data node # (a Data Variable or a Property). # # Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . using namespace OpcLabs.EasyOpc.UA.Forms.Browsing # The path below assumes that the current directory is [ProductDir]/Examples-NET/PowerShell/Windows . Add-Type -Path "../../../Components/Opclabs.QuickOpc/net472/OpcLabs.EasyOpcForms.dll" # Instantiate the dialog object. $dataDialog = New-Object UADataDialog $dataDialog.EndpointDescriptor.UrlString = "http://opcua.demo-this.com:51211/UA/SampleServer" $dataDialog.UserPickEndpoint = $true $dialogResult = $dataDialog.ShowDialog() if ($dialogResult -ne [System.Windows.Forms.DialogResult]::OK) { return } # Display results Write-Host "EndpointDescriptor: $($dataDialog.EndpointDescriptor)" Write-Host "NodeElement: $($dataDialog.NodeElement)"
# This example shows how to let the user browse for an OPC-UA data node (a Data Variable or a Property). # # Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . # OPC client and subscriber examples in Python on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-Python . # The QuickOPC package is needed. Install it using "pip install opclabs_quickopc". import opclabs_quickopc # Import .NET namespaces. from System.Windows.Forms import * from OpcLabs.EasyOpc.UA.Forms.Browsing import * dataDialog = UADataDialog() dataDialog.EndpointDescriptor.UrlString = 'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer' # or 'http://opcua.demo-this.com:51211/UA/SampleServer' (currently not supported) # or 'https://opcua.demo-this.com:51212/UA/SampleServer/' dataDialog.UserPickEndpoint = True dialogResult = dataDialog.ShowDialog() print(dialogResult) if dialogResult != DialogResult.OK: exit() # Display results. print('EndpointDescriptor: ', dataDialog.EndpointDescriptor, sep='') print('NodeElement: ', dataDialog.NodeElement, sep='') print('Finished.')
' This example shows how to let the user browse for an OPC-UA data node (a Data Variable or a Property). ' ' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . Imports OpcLabs.EasyOpc.UA.Forms.Browsing Namespace UAFormsDocExamples._UADataDialog Friend Class ShowDialog Shared Sub Main1(owner As IWin32Window) Dim dataDialog = New UADataDialog() With { .EndpointDescriptor = New OpcLabs.EasyOpc.UA.UAEndpointDescriptor With { .UrlString = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer" }, .UserPickEndpoint = True } ' or "http://opcua.demo-this.com:51211/UA/SampleServer" (currently not supported) ' or "https://opcua.demo-this.com:51212/UA/SampleServer/" Dim dialogResult As DialogResult = dataDialog.ShowDialog(owner) If dialogResult <> DialogResult.OK Then Return End If ' Display results MessageBox.Show(owner, $"EndpointDescriptor: {dataDialog.EndpointDescriptor}" + Environment.NewLine + $"NodeElement: {dataDialog.NodeElement}") End Sub End Class End Namespace
// This example shows how to let the user browse for an OPC-UA data node (a Data Variable or a Property). // // Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . #include "stdafx.h" // Includes "QuickOpc.h", and other commonly used files #include "ShowDialog.h" namespace _UADataDialog { void ShowDialog::Main() { // Initialize the COM library CoInitializeEx(NULL, COINIT_MULTITHREADED); { // _UADataDialogPtr DataDialogPtr(__uuidof(UADataDialog)); // DataDialogPtr->EndpointDescriptor->UrlString = //L"http://opcua.demo-this.com:51211/UA/SampleServer"; L"opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"; DataDialogPtr->UserPickEndpoint = true; // DialogResult dialogResult = DataDialogPtr->ShowDialog(NULL); // Display results if (dialogResult == 1/*OK*/) { _tprintf(_T("%d\n"), dialogResult); _tprintf(_T("EndpointDescriptor: %s\n"), (LPCTSTR)CW2CT(DataDialogPtr->EndpointDescriptor->ToString)); _tprintf(_T("NodeElement: %s\n"), (LPCTSTR)CW2CT(DataDialogPtr->NodeElement->ToString)); } } // Release all interface pointers BEFORE calling CoUninitialize() CoUninitialize(); } }
// This example shows how to let the user browse for an OPC-UA data node // (a Data Variable or a Property). // // Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . class procedure ShowDialog.Main; var DataDialog: UADataDialog; begin // Instantiate the dialog object DataDialog := CoUADataDialog.Create; DataDialog.EndpointDescriptor.UrlString := //'http://opcua.demo-this.com:51211/UA/SampleServer'; 'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer'; DataDialog.UserPickEndpoint := True; DataDialog.ShowDialog(nil); // IMPROVE: check the dialog result // Display results WriteLn('EndpointDescriptor: ', DataDialog.EndpointDescriptor.ToString); WriteLn('NodeElement: ', DataDialog.NodeElement.ToString); end;
// This example shows how to let the user browse for an OPC-UA data node // (a Data Variable or a Property). // // Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . class procedure ShowDialog.Main; var DataDialog: OpcLabs_EasyOpcForms_TLB._UADataDialog; DialogResult: System_Windows_Forms_TLB.DialogResult; begin // Instantiate the dialog object DataDialog := CoUADataDialog.Create; DataDialog.EndpointDescriptor.UrlString := //'http://opcua.demo-this.com:51211/UA/SampleServer'; //'https://opcua.demo-this.com:51212/UA/SampleServer/'; 'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer'; DataDialog.UserPickEndpoint := True; DialogResult := DataDialog.ShowDialog(nil); WriteLn(DialogResult); if DialogResult <> DialogResult_OK then Exit; // Display results WriteLn('EndpointDescriptor: ', DataDialog.EndpointDescriptor.ToString); WriteLn('NodeElement: ', DataDialog.NodeElement.ToString); end;
REM This example shows how to let the user browse for an OPC-UA data node (a Data Variable or a Property). REM REM Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . Private Sub ShowDialog_Main_Command_Click() OutputText = "" Dim DataDialog As New UADataDialog DataDialog.endpointDescriptor.UrlString = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer" DataDialog.UserPickEndpoint = True Dim DialogResult DialogResult = DataDialog.ShowDialog OutputText = OutputText & DialogResult & vbCrLf If DialogResult <> 1 Then ' OK Exit Sub End If ' Display results OutputText = OutputText & "EndpointDescriptor: " & DataDialog.endpointDescriptor & vbCrLf OutputText = OutputText & "NodeElement: " & DataDialog.NodeElement & vbCrLf End Sub
Rem This example shows how to let the user browse for an OPC-UA data node (a Data Variable or a Property). Rem Rem Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . Option Explicit Const DialogResult_OK = 1 Dim DataDialog: Set DataDialog = CreateObject("OpcLabs.EasyOpc.UA.Forms.Browsing.UADataDialog") DataDialog.EndpointDescriptor.UrlString = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer" DataDialog.UserPickEndpoint = True Dim dialogResult: dialogResult = DataDialog.ShowDialog WScript.Echo dialogResult If dialogResult <> DialogResult_OK Then WScript.Quit End If ' Display results WScript.Echo "EndpointDescriptor: " & DataDialog.EndpointDescriptor WScript.Echo "NodeElement: " & DataDialog.NodeElement
Copyright © 2004-2024 CODE Consulting and Development, s.r.o., Plzen. All rights reserved. Web page: www.opclabs.com
Send Documentation Feedback. Resources: Knowledge Base, Product Downloads. Technical support: Online Forums, FAQ.Missing some example? Ask us for it on our Online Forums! You do not have to own a commercial license in order to use Online Forums, and we reply to every post.