gOPCClassicConnector.gAsyncReadOneItem Method

Top  Previous  Next

Description

Used to read value of a single OPC Item asynchronously.

This method does not freeze your application like a synchronous method.

And because this is an asynchronous method, result comes with an event: gAsyncReadOneItemCompleted

 

VB syntax

gOPCClassicConnector.gAsyncReadOneItem(itemID As String, transactionID As String)

 

C# syntax

gOPCClassicConnector.gAsyncReadOneItem(string itemID, string transactionID)

 

Parameters

itemID

ItemID of OPC Item that you want to read value of it .

 

transactionID

Transaction id is ID of asynchronous operation, a unique string.

Used in   gAsyncReadOneItemCompleted  event or to cancel asynchronous operation.

 

Return Type

gOPCClassicFunctionResult

 

C# code example

  try

            {

                //Step1: Run gAsyncReadOneItem method . Input item ID directly in method. TransactionID also needed.          

                GelecekCommon.gOPCClassicFunctionResult function_result = gOPCClassicConnector1.gAsyncReadOneItem(txtItemID1.Text, txtTransactionID.Text);

 

                //Step2: Check function result. For a successfull read, function result should be "OK"

                txtFunctionResult.Text = function_result.ToString();

 

            }

            catch (Exception ex)

            {

                MessageBox.Show(ex.Message);

            }