/// <summary> /// 断开PLC连接 /// </summary> public void ClosePLC() { int iReturnCode; //Return code //Displayed output data is cleared. // //Processing of Close method // try { //When ActProgType is selected by the radio button, //The Close method is executed. iReturnCode = lpcom_ReferencesUtlType.Close(); //When The Close method is succeeded, enable the TextBox of 'LogocalStationNumber'. if (iReturnCode == 0) { isPLCConnected = false; } lpcom_ReferencesUtlType = null; //The return code of the method is displayed by the hexadecimal. } //Exception processing catch (Exception exception) { MessageBox.Show(exception.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
public ConnectPLC() { /* Create instance for ACT Controls*************************************/ lpcom_ReferencesUtlType = new ActUtlTypeLib.ActUtlType(); /* Set EventHandler for ACT Controls************************************/ // Create EventHandler(ActUtlType) /**************************************************************************/ }