Unload vs. Hide

Unload vs. Hide

Question:
My application makes use of different forms.I call forms by ‘hide’ the current form and ‘show 1’ to showthe next one.When I want to return to the previous form I use ‘hide’ or’unload’ the current form and ‘show 1’ the first one.so to go from my mainform to the next one using a commandbutton:

frmMain.HidefrmInput.Show 1 
and to go back from frmInput to frmMain (also using a commandbutton):
frmInput.Hide (or Unload frmInput)frmMain.Show 1
The problem is that when I go from frmMain to frmInput and back for say 5 or 6times, I get the errormessage ‘Out of Stack Space’. First I thought it was a memoryvarible-problem, but when I use the Call method I saw 1 frmInput call and about 10 frmMain calls, so the stack was full.How can I make my program work so I don’t have this problem anymore?I think it’s a sort of problem that VB opens frmMain everytime I go back to frmMain, but I only want to open it once.

Answer:
I would recommend that you always unload a form when you are done with it. Depending on the way your program is written now, that may be somewhat difficult. However, replacing all of your hides with unloads may get you more time. I’ve run into the same problem before.Probably the easiest way to change all of the calls would be to do a global search and replace. Don’t tell it to “replace all” though, find each one singly and decide whether or not you need to replace it.Also, I would consider carefully the need to make your forms modal. Only do this if the program actually needs a modal form in a given situation.

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

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes