gOPCClassicConnector.gAsyncReadOneItemCompleted Event

Top  Previous  Next

Description

Occurs when gAsyncReadOneItem method is completed.

 

VB syntax

Private Sub gOPCClassicConnector_gAsyncReadOneItemCompleted(sender As Object, transactionID As String, resultObject As gOPCClassicReadWriteObjectHandles gOPCClassicConnector.gAsyncReadOneItemCompleted

 

C# syntax

private void gOPCClassicConnector_gAsyncReadOneItemCompleted(object sender, string transactionID, gOPCClassicReadWriteObject resultObject)

 

Arguments

sender

OPC Classic Connector that raising this event.

 

transactionID

ID of asynchronous operation that caused this event.

 

resultObject

Object that holds information.

 

C# code example

    //This event is response to gAsyncReadOneItem method.

        private void gOPCClassicConnector1_gAsyncReadOneItemCompleted(object sender, string transactionID, GelecekCommon.gOPCClassicReadWriteObject resultObject)

        {

            try

            {

                //Check transaction ID and get value..

                if (transactionID == txtTransactionID.Text)

                {

                    txtResultID1.Text = resultObject.ResultID.ToString();

                    txtQuality1.Text = resultObject.Quality.ToString();

 

                    //Check ResultID and Quality

                    //For a successfull read, ResultID sould be "S_OK" and Quality should be "good"

                    if (resultObject.ResultID == Opc.ResultID.S_OK && resultObject.Quality == Opc.Da.Quality.Good)

                    {

                        txtValue1.Text = resultObject.Value.ToString();  //Be careful, Value should be able to convert to string..

                    }

                }

            }

            catch (Exception ex)

            {

                MessageBox.Show(ex.Message);

            }

 

        }