public void PLCdeclarations(DataTable dt)
        {
            string mainVar        = @"VAR_GLOBAL" + Environment.NewLine;
            string endMain        = Environment.NewLine + @"          
END_VAR";
            string constDeclStart = @"VAR_GLOBAL CONSTANT" + Environment.NewLine;
            string constDeclEnd   = Environment.NewLine + @"          
END_VAR";

            createDriveStruct();
            System.Threading.Thread.Sleep(3000);
            //Add function blocks to MAIN declaration
            ITcSmTreeItem main      = sysMan.LookupTreeItem("TIPC^Untitled1^Untitled1 Project^GVLs");
            ITcSmTreeItem GVL       = main.CreateChild("MDR_Control_FBs", 615, "", 0);
            ITcSmTreeItem StructGVL = main.CreateChild("EP7402_List", 615, "", 0);
            //Cast to specific interface for declaration and implementation area
            ITcPlcDeclaration mainDecl   = (ITcPlcDeclaration)GVL;
            ITcPlcDeclaration structDecl = (ITcPlcDeclaration)StructGVL;



            //Get current declaration and implementation area content
            string strMainDecl   = mainDecl.DeclarationText;
            string strStructDecl = structDecl.DeclarationText;

            //string strMainImpl = mainImpl.ImplementationText;
            _nDriveCount = dt.Rows.Count;
            string[] boxName = new string[_nDriveCount];
            int      j       = 0;
            int      i       = 0;

            string structCount = string.Format(" nDriveCount : UINT := {0};", _nDriveCount);

            for (i = 0; i < _nDriveCount - 1; i++)
            {
                boxName[i] = dt.Rows[j].ItemArray[0].ToString() + j.ToString();
                //Console.WriteLine(boxName[i]);
                j++;
            }


            declarations             = string.Join(": FB_MDR_Control;" + Environment.NewLine, boxName);
            mainDecl.DeclarationText = mainVar + declarations + endMain;

            for (i = 0; i < _nDriveCount - 1; i++)
            {
                boxName[i] = boxName[i].Insert(0, "st");
            }


            declarations = string.Join(": ST_EP7402;" + Environment.NewLine, boxName);
            structDecl.DeclarationText = mainVar + declarations + endMain + Environment.NewLine + constDeclStart + structCount + constDeclEnd;
            createFBCalls(boxName);

            System.Threading.Thread.Sleep(2000);
            var settings = dte.GetObject("TcAutomationSettings");

            settings.SilentMode = true;
            dte.Solution.SolutionBuild.Build(true); // compile the plc project
            settings.SilentMode = false;
        }