Singleton mode is a commonly used software design mode. In its core structure, it only contains a special class called a singleton. Through the singleton pattern, it can be ensured that there is only one instance of a class in the system that applies this pattern. That is, a class has only one object instance.
That is, we can only instantiate one class in my instantiation, so the problem is how to close this instance and then we can open the problem of becoming a beginner again, so I will explain it today.
1. Create a singleton mode in the main form.
2. Find the formclosing event in the subform.
3. Double-click after finding the formClosing event, and add the following
code to the FormClosing event. The code means to clear the instance.
This way you can re-instantiate the form and open it multiple times.
Reconstruction of the computer room-application of singleton mode
Guess you like
Origin blog.csdn.net/weixin_48850992/article/details/108492301
Recommended
Ranking