load form in vb.net

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've got tthree forms at start up
splashscreen- works fine however how do i set the time delay so it stays on
the window longer,, shows longer??
Loginscreen- works fine, after the data processing of username etc is done I
then need to load, call whatever the syntax is the mainForm at the end of the
loginscreen..????? how is that done so it starts at the mainForm_Load
procedure??? As it stands now the mainform loads but just for a split
second??>>

MItch
 
I had a simillar issue.

I had a "main form", "a spash screen", and a "login form".

I main my #1 form in vb to be the "Main Form.

On the OnLoad of the Main form, I call the splash screen.

The splash screen will show even before the main form paints.

Now, if you want the login form to show after the main form is painted, the
only way I have solved this by putting the login.show somewhere, is kinda
silly but it works. I added a timer to the main form, and put a 1/2 second
timer delay on it.
When the timer fires, i timer.enabled = false, and i show my login form.

I realy couldnt figure out where to put the login form call so my main form
displays and then the login on top.

Miro
 
Miro,

You can use in this case in your load form method a login form that you call
with ShowDialog, if you use it like this than the mainform is not even
showed.

If myLoginForm.ShowDialog <> Dialogresult.OK then
messagebox.show("your login was wrong")
me.close
End if

I hope this helps,

Cor
 
OK but here is my problem I have the login form as my main for,, that way the
splash scrren starts then it goes to the login form i dont want the useres to
see the main form until login is sucessful??? How do i call the main form
from the end of the login form????????
 
I'm going to recommend that you avoid starting an app by running a form.
There is no upside to doing this and you're experiencing the downside. :-)

Declare a PUBLIC Sub Main() and have that be the starting point. Then you
have complete control of what happens and when.

Public Shared Sub Main(ByVal args() as String)

' show the splash screen
' load the user settings initialize stuff
' hide the splash screen

' if everything is okay so far

' show the login dialog
' if the login is successful
' run the main form
' end if

' end if

You have a chance to get the command line arguments (if there are any) and
you can display and hide the splash screen at will. You also have the user
settings prior to anything much else happening which might contain settings
for screen positions, colors, sounds, server name, etc. And the main screen
isn't loaded until the login is successful.

Re: your splash screen timing. I wrote a SplashScreen class that does it
all for me but basically you set the "minimum" time you want it to display
as you display it. There is no reason to set up any kind of timer at that
point but you do make note of the time it was displayed. When you go to
close the splash screen the routine first checks to see if the
initialization took longer than the minimum time (check the time now against
the time you saved). If it is over the minimum it goes ahead and closes the
screen if it is less than the minimum it goes to sleep for the remaining
amount of time and then closes it.

Hope this helps,
Tom
 
Yes in my case however I wanted to show the main form.

So I needed to use the timer to display it 1/2 second after the main form.
-Unless there is another way?

M.
 
I think the only way u can do this than, is that you will need to create an
"invisible form as ur main form, and do it that way.

Miro
 
Miro,

Do you mean that your mainform is not showed after this, than there is
something terrible wrong.

If the login is correct, it does not close the mainform but shows it.

:-)

Cor
 
No,

Just a misunderstanding,

I wanted my Login form Showing ontop of my Main form. So thats why I had
to use a timer - To show something after the mian form loads.
I was looking for something like MainForm.AfterLoadandPaint
but instead it was a 1/2 second timer that disables itself on its first run.
:)


I could not have a
Dim fLogon As Form = New frmLogon()
fLogon.ShowDialog()
in my _FormLoad of my Main form, cause I wanted to paint the back screen
prior to asking for a login.

Cheers,

Miro
 
Back
Top