gOPCClassicConnector.gRemoveOneItemAndObjectFromConnectionGroup Method

Top  Previous  Next

Description

Deletes connection defined with ConnectionObject.

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

 

VB syntax

gOPCClassicConnector.gRemoveOneItemAndObjectFromConnectionGroup(groupName As StringByRef connectionObject As gOPCClassicConnectionObject)

 

C# syntax

gOPCClassicConnector.gRemoveOneItemAndObjectFromConnectionGroup(string groupName, ref gOPCClassicConnectionObject connectionObject)

 

Parameters

groupName

Name of group that ConnectionObject will be removed from.

 

connectionObject

A ConnectionObject that specifies what itemID, property and control will be  removed.

 

Return Type

gOPCClassicFunctionResult

 

C# code example

  try

            {

                //Step1: Create a connection object and assign ItemID, control and property you want to remove

                GelecekCommon.gOPCClassicConnectionObject connection_object = new GelecekCommon.gOPCClassicConnectionObject();

                connection_object.ItemID = txtItemID1.Text;

                connection_object.Control = txtValue1;

                connection_object.PropertyName = "Text";

 

                //Step2: Apply gRemoveOneItemAndObjectFromConnectionGroup method

                GelecekCommon.gOPCClassicFunctionResult function_result = gOPCClassicConnector1.gRemoveOneItemAndObjectFromConnectionGroup(txtGroupName.Text, ref connection_object);

 

                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_object.ResultID.ToString();

                }

            }

            catch (Exception ex)

            {

                MessageBox.Show(ex.Message);

            }