When you define a form named MyForm, Visual Basic creates one instance with the name “MyForm.” Many programmers confuse this special instance with other instances created using Dim. For example, the Caption statement in this code sets the caption on the automatically created instance. When the instance FRM appears, its caption is not set:
Dim frm As New MyForm MyForm.Caption = "This is the single instance" frm.Show
Even more confusing problems can arise if you use MyForm within the MyForm code module, when an instance such as FRM might accidentally set properties on the automatically created form rather than itself. For this reason, never use MyForm within the MyForm code module.
Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.
























