Search code examples
c#revit-apirevit

Revit addin, Reset all values of forms when start


I created an add in on Revit using a form. When i start the add in for the first time (add-in tab in revit and external tool and "my program"), it correctly execute the Initialization of the form but, when i close it and re-open it (always add-in tab and external tool and "my program") it doesn't execute the program i put behind IniatilizeComponent().

namespace Import_Selected_DET
{
    public partial class Interface_LIB : Form
    {
        #region Variables
        public static string chemFAB = "";
        static string chemGAM = "";
        static string chemREP = "";//Correspond au chemin de fichier le plus avancé
        static string thisOne = "";//Repertoire dans lequel se trouve le fichier a prendre
        static string chemLIB = @"C:\ProgramData\Letitbim";
        static string chemProg = chemLIB + @"\Import_Selected_DET";
        static string chemRes = chemProg + @"\Ressources.txt";
        static int compteErreur = 0;
        static string utilisateur = Environment.UserName;

        #endregion
        public Interface_LIB()
        {
            InitializeComponent();

            //This part doesn't execute the second time... Why ?
        }
    }
}

Solution

  • The solution was find on Autodesk Forum. There is a link :

    https://forums.autodesk.com/t5/revit-api-forum/c-addin-form-reset-the-form-when-show/m-p/9459022/highlight/false#M46368

    Thank you Adrian Efford and Jeremy Tammik for your comment and Answer.