closing a windows form

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bill

    #1

    closing a windows form

    Vb.net
    I have 2 windows forms
    One is used as the splash screen
    I have the timer set to 5000
    and enabled

    I want the first screen to close and open a second form
    the splash screen closes and then the second form never
    opens.

    Under the tick event

    me.close()
    dim form1 as new form1
    form1.show


    Why doesnt this work


    Thanks

  • Harald Bjorøy

    #2
    Re: closing a windows form

    me.Close() unloads the resources of the form, and probably stops code
    execution; if not - it would unload the newly created object because its
    "owner" or "parent" is unloaded.

    A better design would probably be to open the splash screen modal in the
    "main()" function, then after that closes, open the "real" main window;

    In the "Main()" -function (located in the "real" application form):
    ....

    Dim frmMain as new Form1
    Dim frmSplash as new SplashScreen ' Includes a message and a timer that
    makes it close it self

    frmSplash.ShowD ialog(frmMain)

    Application.Run (frmMain)

    Regards,
    Harald Bjorøy


    "bill" <bkelleman@pcda ta1.com> wrote in message
    news:0e1801c37d 18$43435880$a10 1280a@phx.gbl.. .[color=blue]
    > Vb.net
    > I have 2 windows forms
    > One is used as the splash screen
    > I have the timer set to 5000
    > and enabled
    >
    > I want the first screen to close and open a second form
    > the splash screen closes and then the second form never
    > opens.
    >
    > Under the tick event
    >
    > me.close()
    > dim form1 as new form1
    > form1.show
    >
    >
    > Why doesnt this work
    >
    >
    > Thanks
    >[/color]


    Comment

    Working...