Container Controls - Check Status

I am developing a database front end that makes use of Container Controls with various text boxes, buttons, etc corresponding to different operations and tables. When the user switches operations I need to close the current CC before embedding the new one.

In order to determine whether a CC is open/visible/in use, I have a corresponding boolean global variable that is set to False when the CC is closed and True when embedded.

Question: Is there a better way of determining whether a CC is open? Just seems a bit messy with so many global variables. I can’t identify a CC property that corresponds. If I check visible status, the program crashes if the CC has not yet been embedded/used.

Regards - Keir

You can use the ContainerControl itself as variable instead of having a boolean variable. Just dim the property as ContainerControl. Something along this:

If Module1.ContainerControl <> Nil And Module1.ContainerControl.Visible Then // Exists and is visible End

Hi, Eli

A simple solution that is perfect. Thank you!

Regards - Keir