Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hello,

 

I need some newbie help.

 

I want to load a form from another in VB.Net. I used to do this using Load Form in VB, and the form used to stay visible even after the form that I loaded it from was destroyed.

 

I have tried creating a global variable for the form, but still whenever i dispose the calling form, my new form unloads as well.

 

... I need to load a form from another, and keep it loaded even when the first form is destroyed...

 

All help will be appreciated.

 

Regards

CyrilGupta

Posted

Ok.. I found the solution.

 

Apparently nothing is wrong with the variable that I am declaring. It's just the difference in the way that VB and VB.Net handles things.

 

In VB6, I used to set the Startup form to the splash screen and start using it. After 2-3 seconds, I'd unload the splash screen and move to the main form.

 

Not in VB.Net. In VB.Net when you destroy the startup object (form, or sub main), the entire program thread finishes. That's why the entire program was unloading when I tried to change forms, and the same problem was present even in sub main.

 

The solution is this..

 

1. Show a form using Showdialog in Sub Main instead of show.

2. Show the splash screen before the Initializecomponents call of the main form.

 

Posted this just to help others who might be facing the same problem.

 

Cheerios

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...