gOPCClassicConnector.gRemoveItemsAndObjectsFromConnectionGroup Method

Top  Previous  Next

Description

Deletes connections defined with ConnectionObjects.

After this operation, if all connections are deleted in group, group is also deleted.

 

VB syntax

gOPCClassicConnector.gRemoveItemsAndObjectsFromConnectionGroup(groupName As StringByRef connectionObjects() As gOPCClassicConnectionObject)

 

C# syntax

gOPCClassicConnector.gRemoveItemsAndObjectsFromConnectionGroup(string groupName, ref gOPCClassicConnectionObject[] connectionObjects) 

 

Parameters

groupName

Name of group that ConnectionObjects will be removed from.

 

connectionObjects

An array of ConnectionObjects that specify what itemIDs, properties and controls will be  removed.

 

Return Type

gOPCClassicFunctionResult

 

C# code example

  try

            {

                //Step1: Create an array of connection objects and assign ItemID, control and property you want to remove

                GelecekCommon.gOPCClassicConnectionObject[] connection_objects = new GelecekCommon.gOPCClassicConnectionObject[2];

                connection_objects[0] = new GelecekCommon.gOPCClassicConnectionObject();

                connection_objects[0].ItemID = txtItemID1.Text;

                connection_objects[0].Control = txtValue1;

                connection_objects[0].PropertyName = "Text";

 

                connection_objects[1] = new GelecekCommon.gOPCClassicConnectionObject();

                connection_objects[1].ItemID = txtItemID2.Text;

                connection_objects[1].Control = txtValue2;

                connection_objects[1].PropertyName = "Text";

 

 

 

                //Step2: Apply gRemoveOneItemAndObjectFromConnectionGroup method

                GelecekCommon.gOPCClassicFunctionResult function_result = gOPCClassicConnector1.gRemoveItemsAndObjectsFromConnectionGroup(txtGroupName.Text, ref connection_objects);

 

                txtFunctionResult.Text = function_result.ToString();

 

                //Setp3: Check Result

                //For a successfull remove, function result should be "OK" and ResultID sould be "S_OK"

                if (function_result == GelecekCommon.gOPCClassicFunctionResult.OK)

                {

                    txtResultID1.Text = connection_objects[0].ResultID.ToString();

                    txtResultID2.Text = connection_objects[1].ResultID.ToString();

                }

            }

            catch (Exception ex)

            {

                MessageBox.Show(ex.Message);

            }