QuickOPC User's Guide and Reference
CurrentNodeDescriptor Property (UABrowseInputsOutputs)
Example 



OpcLabs.EasyOpcForms Assembly > OpcLabs.EasyOpc.UA.Forms.Browsing Namespace > UABrowseInputsOutputs Class : CurrentNodeDescriptor Property
Contain information necessary to identify the current node.
Syntax
'Declaration
 
Public Property CurrentNodeDescriptor As UABrowseNodeDescriptor
'Usage
 
Dim instance As UABrowseInputsOutputs
Dim value As UABrowseNodeDescriptor
 
instance.CurrentNodeDescriptor = value
 
value = instance.CurrentNodeDescriptor
public UABrowseNodeDescriptor CurrentNodeDescriptor {get; set;}
public:
property UABrowseNodeDescriptor^ CurrentNodeDescriptor {
   UABrowseNodeDescriptor^ get();
   void set (    UABrowseNodeDescriptor^ value);
}
Example

.NET

COM

// This example shows how to allow browsing for an OPC Unified Architecture node by placing a browsing control on the form.

using System;
using System.Windows.Forms;
using OpcLabs.BaseLib;
using OpcLabs.EasyOpc.UA.Forms.Browsing;

namespace UAFormsDocExamples._UABrowseControl
{
    public partial class UsageForm : Form
    {
        public UsageForm()
        {
            InitializeComponent();
        }

        private void getOutputsButton_Click(object sender, EventArgs e)
        {
            // Obtain the current node element.
            UABrowseNodeElement currentNodeElement = uaBrowseControl1.Outputs.CurrentNodeElement;

            // Display the present parts of the current node element in the outputs text text box.
            outputsTextBox.Text = "";
            if (!(currentNodeElement.HostElement is null))
                outputsTextBox.Text += $"{nameof(UABrowseNodeElement.HostElement)}: {currentNodeElement.HostElement}\r\n";
            if (!(currentNodeElement.DiscoveryElement is null))
                outputsTextBox.Text += $"{nameof(UABrowseNodeElement.DiscoveryElement)}: {currentNodeElement.DiscoveryElement}\r\n";
            if (!(currentNodeElement.NodeElement is null))
                outputsTextBox.Text += $"{nameof(UABrowseNodeElement.NodeElement)}: {currentNodeElement.NodeElement}\r\n";
        }

        private void uaBrowseControl1_BrowseFailure(object sender, FailureEventArgs e)
        {
            // Append the event name and its arguments to the browsing events text box.
            browsingEventsTextBox.Text += $"{nameof(UABrowseControl.BrowseFailure)}: {e}\r\n";
        }

        private void uaBrowseControl1_CurrentNodeChanged(object sender, EventArgs e)
        {
            // Append the event name and the current node element to the browsing events text box.
            browsingEventsTextBox.Text += $"{nameof(UABrowseControl.CurrentNodeChanged)}; {uaBrowseControl1.Outputs.CurrentNodeElement}\r\n";
        }

        private void uaBrowseControl1_NodeDoubleClick(object sender, EventArgs e)
        {
            // Append the event name to the browsing events text box.
            browsingEventsTextBox.Text += $"{nameof(UABrowseControl.NodeDoubleClick)}\r\n";
        }

        private void uaBrowseControl1_SelectionChanged(object sender, EventArgs e)
        {
            // Append the event name to the browsing events text box.
            browsingEventsTextBox.Text += $"{nameof(UABrowseControl.SelectionChanged)}\r\n";
        }

        private void setInputsButton_Click(object sender, EventArgs e)
        {
            // Set the current node to our pre-defined OPC UA server.
            uaBrowseControl1.InputsOutputs.CurrentNodeDescriptor.EndpointDescriptor = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer";
        }
    }
}
namespace UAFormsDocExamples._UABrowseControl
{
    partial class UsageForm
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.uaBrowseControl1 = new OpcLabs.EasyOpc.UA.Forms.Browsing.UABrowseControl();
            this.setInputsButton = new System.Windows.Forms.Button();
            this.getOutputsButton = new System.Windows.Forms.Button();
            this.label1 = new System.Windows.Forms.Label();
            this.outputsTextBox = new System.Windows.Forms.TextBox();
            this.browsingEventsTextBox = new System.Windows.Forms.TextBox();
            ((System.ComponentModel.ISupportInitialize)(this.uaBrowseControl1)).BeginInit();
            this.SuspendLayout();
            // 
            // uaBrowseControl1
            // 
            this.uaBrowseControl1.Location = new System.Drawing.Point(13, 42);
            this.uaBrowseControl1.MinimumSize = new System.Drawing.Size(135, 150);
            this.uaBrowseControl1.Name = "uaBrowseControl1";
            this.uaBrowseControl1.Size = new System.Drawing.Size(450, 300);
            this.uaBrowseControl1.TabIndex = 0;
            this.uaBrowseControl1.BrowseFailure += new OpcLabs.BaseLib.FailureEventHandler(this.uaBrowseControl1_BrowseFailure);
            this.uaBrowseControl1.CurrentNodeChanged += new System.EventHandler(this.uaBrowseControl1_CurrentNodeChanged);
            this.uaBrowseControl1.NodeDoubleClick += new System.EventHandler(this.uaBrowseControl1_NodeDoubleClick);
            this.uaBrowseControl1.SelectionChanged += new System.EventHandler(this.uaBrowseControl1_SelectionChanged);
            // 
            // setInputsButton
            // 
            this.setInputsButton.Location = new System.Drawing.Point(13, 13);
            this.setInputsButton.Name = "setInputsButton";
            this.setInputsButton.Size = new System.Drawing.Size(75, 23);
            this.setInputsButton.TabIndex = 1;
            this.setInputsButton.Text = "&Set inputs";
            this.setInputsButton.UseVisualStyleBackColor = true;
            this.setInputsButton.Click += new System.EventHandler(this.setInputsButton_Click);
            // 
            // getOutputsButton
            // 
            this.getOutputsButton.Location = new System.Drawing.Point(13, 349);
            this.getOutputsButton.Name = "getOutputsButton";
            this.getOutputsButton.Size = new System.Drawing.Size(75, 23);
            this.getOutputsButton.TabIndex = 2;
            this.getOutputsButton.Text = "&Get outputs";
            this.getOutputsButton.UseVisualStyleBackColor = true;
            this.getOutputsButton.Click += new System.EventHandler(this.getOutputsButton_Click);
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(481, 42);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(88, 13);
            this.label1.TabIndex = 3;
            this.label1.Text = "&Browsing events:";
            // 
            // outputsTextBox
            // 
            this.outputsTextBox.Location = new System.Drawing.Point(13, 379);
            this.outputsTextBox.Multiline = true;
            this.outputsTextBox.Name = "outputsTextBox";
            this.outputsTextBox.ReadOnly = true;
            this.outputsTextBox.Size = new System.Drawing.Size(951, 59);
            this.outputsTextBox.TabIndex = 4;
            // 
            // browsingEventsTextBox
            // 
            this.browsingEventsTextBox.Location = new System.Drawing.Point(484, 59);
            this.browsingEventsTextBox.Multiline = true;
            this.browsingEventsTextBox.Name = "browsingEventsTextBox";
            this.browsingEventsTextBox.ReadOnly = true;
            this.browsingEventsTextBox.Size = new System.Drawing.Size(480, 283);
            this.browsingEventsTextBox.TabIndex = 5;
            // 
            // UsageForm
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(976, 450);
            this.Controls.Add(this.browsingEventsTextBox);
            this.Controls.Add(this.outputsTextBox);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.getOutputsButton);
            this.Controls.Add(this.setInputsButton);
            this.Controls.Add(this.uaBrowseControl1);
            this.Name = "UsageForm";
            this.Text = "UsageForm";
            ((System.ComponentModel.ISupportInitialize)(this.uaBrowseControl1)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private OpcLabs.EasyOpc.UA.Forms.Browsing.UABrowseControl uaBrowseControl1;
        private System.Windows.Forms.Button setInputsButton;
        private System.Windows.Forms.Button getOutputsButton;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.TextBox outputsTextBox;
        private System.Windows.Forms.TextBox browsingEventsTextBox;
    }
}
Rem This example shows use the output data (node) from one dialog invocation as input data in a subsequent dialog 
Rem invocation.

Option Explicit

Const DialogResult_OK = 1

' Define the starting node for the first dialog.

Dim BrowseNodeDescriptor0: Set BrowseNodeDescriptor0 = CreateObject("OpcLabs.EasyOpc.UA.Forms.Browsing.UABrowseNodeDescriptor")
BrowseNodeDescriptor0.EndpointDescriptor.UrlString = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
'BrowseNodeDescriptor0.NodeDescriptor.NodeId.StandardName = "Objects"

' Set the starting node of the first dialog, show the first dialog, and let the user select a first node.

Dim BrowseDialog1: Set BrowseDialog1 = CreateObject("OpcLabs.EasyOpc.UA.Forms.Browsing.UABrowseDialog")
Set BrowseDialog1.InputsOutputs.CurrentNodeDescriptor = BrowseNodeDescriptor0
Dim dialogResult1: dialogResult1 = BrowseDialog1.ShowDialog
If dialogResult1 <> DialogResult_OK Then
    WScript.Quit
End If
Dim BrowseNodeDescriptor1: Set BrowseNodeDescriptor1 = BrowseDialog1.InputsOutputs.CurrentNodeDescriptor

' Display the first node chosen.

WScript.Echo
WScript.Echo BrowseNodeDescriptor1.NodeDescriptor.NodeId
WScript.Echo BrowseNodeDescriptor1.NodeDescriptor.BrowsePath

' Set the starting node of the second dialog to be the node chosen by the user before, show the second dialog, and let the
' use select a second node.

Dim BrowseDialog2: Set BrowseDialog2 = CreateObject("OpcLabs.EasyOpc.UA.Forms.Browsing.UABrowseDialog")
Set BrowseDialog2.InputsOutputs.CurrentNodeDescriptor = BrowseNodeDescriptor1
Dim dialogResult2: dialogResult2 = BrowseDialog2.ShowDialog
If dialogResult2 <> DialogResult_OK Then
    WScript.Quit
End If
Dim BrowseNodeDescriptor2: Set BrowseNodeDescriptor2 = BrowseDialog2.InputsOutputs.CurrentNodeDescriptor

' Display the second node chosen.

WScript.Echo
WScript.Echo BrowseNodeDescriptor2.NodeDescriptor.NodeId
WScript.Echo BrowseNodeDescriptor2.NodeDescriptor.BrowsePath
Requirements

Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2016, Windows Server 2022; .NET: Linux, macOS, Microsoft Windows

See Also