OPC Studio User's Guide and Reference
CategoryElements Property (AECategoryDialog)
Example 



OpcLabs.EasyOpcForms Assembly > OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing Namespace > AECategoryDialog Class : CategoryElements Property
A collection of category elements (OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace.AECategoryElement), keyed by their Category Ids.
Syntax
'Declaration
 
Public ReadOnly Property CategoryElements As AECategoryElementCollection
'Usage
 
Dim instance As AECategoryDialog
Dim value As AECategoryElementCollection
 
instance.CategoryElements = value
 
value = instance.CategoryElements
public AECategoryElementCollection CategoryElements {get;}
public:
property AECategoryElementCollection^ CategoryElements {
   AECategoryElementCollection^ get();
}

Property Value

The value of this property cannot be null (Nothing in Visual Basic).

The individual elements of the property value cannot be null (Nothing in Visual Basic).

Remarks

The getter method of this property is pure, i.e. it does not have observable side effects.

Example
// This example shows how to let the user browse for OPC Alarms&Events categories. 
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
// OPC client and subscriber examples in C# on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-CSharp .
// Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
// a commercial license in order to use Online Forums, and we reply to every post.

using System.Linq;
using System.Windows.Forms;
using OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing;

namespace FormsDocExamples._AECategoryDialog
{
    static class ShowDialog
    {
        public static void Main1(IWin32Window owner)
        {
            var categoryDialog = new AECategoryDialog
            {
                ServerDescriptor = {ServerClass = "OPCLabs.KitEventServer.2"}
            };

            DialogResult dialogResult = categoryDialog.ShowDialog(owner);
            if (dialogResult != DialogResult.OK)
                return;

            // Display results
            string categoryElementsString = string.Join("\n", categoryDialog.CategoryElements.Select(element => element));
            MessageBox.Show(owner, categoryElementsString);
        }
    }
}
' This example shows how to let the user browse for OPC Alarms&Events categories.
'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
' OPC client and subscriber examples in VB.NET on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-VBNET .
' Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
' a commercial license in order to use Online Forums, and we reply to every post.

Imports OpcLabs.EasyOpc
Imports OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace
Imports OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing

Namespace FormsDocExamples._AECategoryDialog
    Friend Class ShowDialog
        Shared Sub Main1(owner As IWin32Window)
            Dim categoryDialog = New AECategoryDialog() With {
                .ServerDescriptor = New ServerDescriptor() With {
                    .ServerClass = "OPCLabs.KitEventServer.2"
                }
            }

            Dim dialogResult As DialogResult = categoryDialog.ShowDialog(owner)
            If dialogResult <> DialogResult.OK Then
                Return
            End If

            ' Display results
            Dim categoryElementsString As String = String.Join("\n", categoryDialog.CategoryElements.Select(Function(element As AECategoryElement) element))
            MessageBox.Show(owner, categoryElementsString)
        End Sub
    End Class
End Namespace
# This example shows how to let the user browse for OPC Alarms&Events categories.
#
# 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 .
# Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
# a commercial license in order to use Online Forums, and we reply to every post.
# 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.AlarmsAndEvents.Forms.Browsing import *


categoryDialog = AECategoryDialog()
categoryDialog.ServerDescriptor.ServerClass = "OPCLabs.KitEventServer.2"

dialogResult = categoryDialog.ShowDialog()
print(dialogResult)
if dialogResult != DialogResult.OK:
    exit()

# Display results.
print()
for categoryElement in categoryDialog.CategoryElements:
    print(categoryElement)
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