private void DM_Datastn2txt_TextChanged(object sender, EventArgs e)
        {
            if (DM_Datastn2txt.Text.Length > 10)
            {
                DM_Datastn2txt.Text = DM_Datastn2txt.Text.ToUpper();
                if (check_appref())
                {
                    if (check_previousstation_result(DM_Datastn2txt.Text))
                    {
                        libnoInstance.write_bit_value(address, 61, 1, 6, true);   //ok to flush the component in station 2
                        libnoInstance.write_bit_value(address, 61, 2, 0, true);   //cycle in progress set to false in station 2

                        opmsglbl2.Text      = "PREVIOUS STATION RESULT OK !& LOAD THE COMPONENT IN STN 2";
                        opmsglbl2.ForeColor = Color.Yellow;
                        Cyltimer_2.Enabled  = true;
                    }
                    else
                    {
                        libnoInstance.write_bit_value(address, 61, 1, 6, false);   //nok to flush the component in station 2
                        opmsglbl2.Text      = "CYCLE ABORTED DUE TO PREVIOUS STATION RESULT FAIL IN STN 2";
                        opmsglbl2.ForeColor = Color.Red;
                        Cyltimer_2.Enabled  = false;
                        readdatas           = "";
                        DM_Datastn2txt.Focus();
                        DM_Datastn2txt.Text = "";
                    }
                }
                else
                {
                    opmsglbl2.Text      = "APPLICATION REFERENCE MISMATCH ! IN STN 2";
                    opmsglbl2.ForeColor = Color.Red;
                    readdatas           = "";
                }
            }
        }
 private void cmbapp2_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cmbapp2.SelectedIndex > 0)
     {
         string getapcode = "SELECT APP_CODE FROM APP_MASTER_LANCE3 WHERE APP_NAME = '" + cmbapp2.Text + "'";
         barref2 = objora.GetSingleValue(getapcode);
         DM_Datastn2txt.ReadOnly = false;
         DM_Datastn2txt.Focus();
     }
 }
        private void Cyltimer_2_Tick(object sender, EventArgs e)
        {
            if (libnoInstance.read_bit_value(address, 101, 0, 1).ToString().ToUpper() == "TRUE")  //trigger message of closing guard in station 2
            {
                opmsglbl2.Text      = "CYCLE IN PROGRESS IN STATION 2 ";
                opmsglbl2.ForeColor = Color.Yellow;
            }

            if (libnoInstance.read_bit_value(address, 61, 2, 0).ToString().ToUpper() == "FALSE") //flushing in progress in station 2
            {
                dataType    = LibnoDaveClass.PLCDataType.Integer;
                readIntList = null;
                if (libnoInstance.read_integer_values(address, 61, 14, 11, out readIntList2, dataType, true))
                {
                    if (readIntList2[0].ToString() == "0")
                    {
                        save_results("PASS", 2);
                        libnoInstance.write_bit_value(address, 61, 2, 2, true); //release componnet after datalogging in station 2
                        filldatagrid(2);
                        Cyltimer_2.Enabled = false;
                        libnoInstance.write_bit_value(address, 61, 1, 6, false);   //reset the value in the ok bit (station 2)
                        readdatas = "";
                        DM_Datastn2txt.Focus();
                        DM_Datastn2txt.Text = "";
                    }
                    else
                    {
                        save_results("FAIL", 2);
                        libnoInstance.write_bit_value(address, 61, 2, 2, true); //release componnet after datalogging in station 2
                        filldatagrid(2);
                        Cyltimer_2.Enabled = false;
                        libnoInstance.write_bit_value(address, 61, 1, 6, false); //reset the value in the ok bit (station 2)
                        readdatas = "";
                        DM_Datastn2txt.Focus();
                        DM_Datastn2txt.Text = "";
                    }
                }
            }
            else
            {
                return;
            }
        }