help with an easy question...

P

Paul M

Hi there,

i'm sure this is an easy question.

I have a number of forms in my project, which i am converting from VB6 to
..Net

This is the previous code i have:

frmSplash.Show
DoEvents
Sleep (3000)
Load frmMain
Load FrmNewExisting
LoadRegistrySettings
Unload frmSplash
frmMain.Show
FrmNewExistingProject.Show 1

Firstly, i commented out all lines and put this:

Dim fSplash as new frmSplash
fSplash.Show()


when this executes, it shows the form and then shuts it down?? why?? and
also, how can i preload forms like above, in .NET

thanks in advance,
Paul.
 
G

Guest

You must do some extensive study on Events and the way types are instantiated in .NE
For instance your question: "how do i preload forms in .NET" doesn't have any sense. When you instantiate a form by calling it's constructor it is already "loaded" if you want. You can make it visible or invisible.

Also, when your main application goes out of scope the application closes all open forms. So doing something like

frm = new Form()
frm.Show()

indeed will only show for a few seconds.

On the other hand

Application.Run(frm

will create the correct message dispatching/translation structure required to run the form. In your application you can create a form with the visible property = false; from this form create a timer for 3000 milisecs and then show the splash form with ShowDialog. When the timer ticks, close the slpash form and set the visibility of the main form to true.

hope this helps somehow
iulia
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top