QuickOPC User's Guide and Reference
OpcBrowseNodeElement Class
Members  Example 



OpcLabs.EasyOpcForms Assembly > OpcLabs.EasyOpc.Forms.Browsing Namespace : OpcBrowseNodeElement Class
Contains an OPC "Classic" user browse element, i.a. all available information obtained about a node.
Object Model
OpcBrowseNodeElement ClassAEAttributeElement ClassAECategoryElement ClassAEConditionElement ClassAENodeElement ClassAESubconditionElement ClassComputerElement ClassDANodeElement ClassDAPropertyElement ClassOpcBrowseNodeElement ClassServerElement Class
Syntax
'Declaration
 
<CLSCompliantAttribute(True)>
<ComDefaultInterfaceAttribute(OpcLabs.EasyOpc.Forms.Browsing.ComTypes._OpcBrowseNodeElement)>
<ComVisibleAttribute(True)>
<GuidAttribute("5C0D47E7-60F9-4E2B-8714-9D1BC9E656D8")>
<TypeConverterAttribute(System.ComponentModel.ExpandableObjectConverter)>
<ValueControlAttribute("OpcLabs.BaseLib.Forms.Common.ObjectSerializationControl, OpcLabs.BaseLibForms, Version=5.72.465.1, Culture=neutral, PublicKeyToken=6faddca41dacb409", 
   DefaultReadWrite=False, 
   Export=True, 
   PageId=10001)>
<SerializableAttribute()>
Public NotInheritable Class OpcBrowseNodeElement 
   Inherits OpcLabs.BaseLib.Info
   Implements LINQPad.ICustomMemberProvider, OpcLabs.BaseLib.ComTypes._Info, OpcLabs.BaseLib.ComTypes._Object2, OpcLabs.EasyOpc.Forms.Browsing.ComTypes._OpcBrowseNodeElement, System.ICloneable, System.Runtime.Serialization.ISerializable, System.Xml.Serialization.IXmlSerializable 
'Usage
 
Dim instance As OpcBrowseNodeElement
[CLSCompliant(true)]
[ComDefaultInterface(OpcLabs.EasyOpc.Forms.Browsing.ComTypes._OpcBrowseNodeElement)]
[ComVisible(true)]
[Guid("5C0D47E7-60F9-4E2B-8714-9D1BC9E656D8")]
[TypeConverter(System.ComponentModel.ExpandableObjectConverter)]
[ValueControl("OpcLabs.BaseLib.Forms.Common.ObjectSerializationControl, OpcLabs.BaseLibForms, Version=5.72.465.1, Culture=neutral, PublicKeyToken=6faddca41dacb409", 
   DefaultReadWrite=false, 
   Export=true, 
   PageId=10001)]
[Serializable()]
public sealed class OpcBrowseNodeElement : OpcLabs.BaseLib.Info, LINQPad.ICustomMemberProvider, OpcLabs.BaseLib.ComTypes._Info, OpcLabs.BaseLib.ComTypes._Object2, OpcLabs.EasyOpc.Forms.Browsing.ComTypes._OpcBrowseNodeElement, System.ICloneable, System.Runtime.Serialization.ISerializable, System.Xml.Serialization.IXmlSerializable  
[CLSCompliant(true)]
[ComDefaultInterface(OpcLabs.EasyOpc.Forms.Browsing.ComTypes._OpcBrowseNodeElement)]
[ComVisible(true)]
[Guid("5C0D47E7-60F9-4E2B-8714-9D1BC9E656D8")]
[TypeConverter(System.ComponentModel.ExpandableObjectConverter)]
[ValueControl("OpcLabs.BaseLib.Forms.Common.ObjectSerializationControl, OpcLabs.BaseLibForms, Version=5.72.465.1, Culture=neutral, PublicKeyToken=6faddca41dacb409", 
   DefaultReadWrite=false, 
   Export=true, 
   PageId=10001)]
[Serializable()]
public ref class OpcBrowseNodeElement sealed : public OpcLabs.BaseLib.Info, LINQPad.ICustomMemberProvider, OpcLabs.BaseLib.ComTypes._Info, OpcLabs.BaseLib.ComTypes._Object2, OpcLabs.EasyOpc.Forms.Browsing.ComTypes._OpcBrowseNodeElement, System.ICloneable, System.Runtime.Serialization.ISerializable, System.Xml.Serialization.IXmlSerializable  
Example

.NET

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

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

namespace FormsDocExamples._OpcBrowseControl
{
    public partial class UsageForm : Form
    {
        public UsageForm()
        {
            InitializeComponent();
        }

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

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

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

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

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

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

        private void setInputsButton_Click(object sender, EventArgs e)
        {
            // Set the current node to a pre-defined OPC DA item on our server.
            opcBrowseControl1.InputsOutputs.CurrentNodeDescriptor.ServerDescriptor = "OPCLabs.KitServer.2";
            opcBrowseControl1.InputsOutputs.CurrentNodeDescriptor.DANodeDescriptor = "Demo.Ramp";
        }
    }
}
namespace FormsDocExamples._OpcBrowseControl
{
    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.opcBrowseControl1 = new OpcLabs.EasyOpc.Forms.Browsing.OpcBrowseControl();
            this.setInputsButton = new System.Windows.Forms.Button();
            this.getOutputsButton = new System.Windows.Forms.Button();
            this.label1 = new System.Windows.Forms.Label();
            this.browsingEventsTextBox = new System.Windows.Forms.TextBox();
            this.outputsTextBox = new System.Windows.Forms.TextBox();
            ((System.ComponentModel.ISupportInitialize)(this.opcBrowseControl1)).BeginInit();
            this.SuspendLayout();
            // 
            // opcBrowseControl1
            // 
            this.opcBrowseControl1.Location = new System.Drawing.Point(13, 42);
            this.opcBrowseControl1.MinimumSize = new System.Drawing.Size(135, 150);
            this.opcBrowseControl1.Name = "opcBrowseControl1";
            this.opcBrowseControl1.Size = new System.Drawing.Size(450, 300);
            this.opcBrowseControl1.TabIndex = 0;
            this.opcBrowseControl1.BrowseFailure += new OpcLabs.BaseLib.FailureEventHandler(this.opcBrowseControl1_BrowseFailure);
            this.opcBrowseControl1.CurrentNodeChanged += new System.EventHandler(this.opcBrowseControl1_CurrentNodeChanged);
            this.opcBrowseControl1.NodeDoubleClick += new System.EventHandler(this.opcBrowseControl1_NodeDoubleClick);
            this.opcBrowseControl1.SelectionChanged += new System.EventHandler(this.opcBrowseControl1_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(479, 42);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(88, 13);
            this.label1.TabIndex = 3;
            this.label1.Text = "Browsing &events:";
            // 
            // browsingEventsTextBox
            // 
            this.browsingEventsTextBox.Location = new System.Drawing.Point(482, 59);
            this.browsingEventsTextBox.Multiline = true;
            this.browsingEventsTextBox.Name = "browsingEventsTextBox";
            this.browsingEventsTextBox.ReadOnly = true;
            this.browsingEventsTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
            this.browsingEventsTextBox.Size = new System.Drawing.Size(482, 283);
            this.browsingEventsTextBox.TabIndex = 4;
            // 
            // 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, 68);
            this.outputsTextBox.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.outputsTextBox);
            this.Controls.Add(this.browsingEventsTextBox);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.getOutputsButton);
            this.Controls.Add(this.setInputsButton);
            this.Controls.Add(this.opcBrowseControl1);
            this.Name = "UsageForm";
            this.Text = "Usage";
            ((System.ComponentModel.ISupportInitialize)(this.opcBrowseControl1)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private OpcLabs.EasyOpc.Forms.Browsing.OpcBrowseControl opcBrowseControl1;
        private System.Windows.Forms.Button setInputsButton;
        private System.Windows.Forms.Button getOutputsButton;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.TextBox browsingEventsTextBox;
        private System.Windows.Forms.TextBox outputsTextBox;
    }
}
Inheritance Hierarchy

System.Object
   OpcLabs.BaseLib.Object2
      OpcLabs.BaseLib.Info
         OpcLabs.EasyOpc.Forms.Browsing.OpcBrowseNodeElement

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