Close All Forms Before the End of a Program

Close All Forms Before the End of a Program

It is well known that VB3 is not always as conscientious as itshould be about unloading all the forms in an application whentheapplication terminates. Because unloading all the forms for anapplication manually can be tricky, I have developed a small routinethat can be called as a prelude to the End statement:

 Sub Main ()'' Blah, blah, blah...our code here....'CloseFormsEndEnd SubSub CloseForms()        Dim iFormCount As Integer        Dim i As Integer        'Nothing's gonna stop us now....        On Error Resume Next        'Store the number of forms NOW         'because the count will change as         'we close them        iFormCount = Forms.Count - 1        'Step downward through the Forms         'Collection to ensure we get         'ALL of them...        For i = iFormCount To 0 Step -1                Unload Forms(i)                Set Forms(i) = Nothing         NextEnd Sub

The key here is to get the count of the number of open forms andthen loop from that number down to make absolutely sure that allforms in the application are unloaded.

Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several