Check form loaded and hidden

Check form loaded and hidden

SRSDS
Advisor Advisor
483 Views
2 Replies
Message 1 of 3

Check form loaded and hidden

SRSDS
Advisor
Advisor

Hi,

 

I am loading a form which is populated with several pictures and controls. 

There is a small delay in it's loading so I would like to hide it and make it visible again.

How do I check if it's loaded?

            If SOMETHING Then
                FormShapes.Show()
            Else
                Application.ShowModalDialog(Application.MainWindow.Handle, FormShapes, False)
            End If

 

 

0 Likes
Accepted solutions (1)
484 Views
2 Replies
Replies (2)
Message 2 of 3

_gile
Consultant
Consultant
Accepted solution

Hi,

 

You can use a static (Shared) field to store the form instance that you initialize only once per session if it's null (Nothing).

        static Dialog formShapes = null;

        public static void SomeMethod()
        {
            var doc = Application.DocumentManager.MdiActiveDocument;
            if (formShapes == null)
                formShapes = new Dialog(); // or whatever the form class name
Application.ShowModalDialog(doc.Window.Handle, formShapes, false);
[...] }

 



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 3 of 3

SRSDS
Advisor
Advisor

Thank you.

0 Likes