Cancelling a Window During Load

Question:
Supposing that in Form_Load I determine that I wish to cancel the load of the form (so that nothing is in memory and nothing is displayed to the user). How can I do this? An Unload Me does not work, since the form has not yet been loaded.

Answer:
The easiest thing to do would be to set a constant in the Form_Load event that would determine whether or not the window could continue. That way, whenever the Form_Activate event fires immediately after the Form_Load, it can unload the window if necessary.

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist