Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Unload form, load another, forget about original form

5 views
Skip to first unread message

Bob

unread,
Jul 6, 2003, 6:00:31 PM7/6/03
to
Does anyone have any simple code for having a form, upon executing an
ME.CLOSE statement, open another form and pass control to it, forever
forgetting about the original form? Any help is appreciated.

Thx


Armin Zingler

unread,
Jul 6, 2003, 6:21:30 PM7/6/03
to
"Bob" <b...@bobber.com> schrieb

Shared Sub Main()
Dim f As New Form1
f.Show()
Application.Run()
End Sub

Protected Overrides Sub OnClosed(ByVal e As System.EventArgs)
Dim f2 As Form2
MyBase.OnClosed(e)
f2 = New Form2
f2.show()
End Sub


Now you must call Application.ExitThread to exit Application.Run when the
application is to be terminated.


--
Armin

Herfried K. Wagner

unread,
Jul 6, 2003, 6:55:53 PM7/6/03
to
Hello,

"Bob" <b...@bobber.com> schrieb:

\\\
Public Class Main
Public Sub Main()
Call (New Form1()).Show()
Application.Run() ' Create message loop.
End Sub
End Class

Public Class Form1
.
.
.
Call (New Form2()).Show()
Me.Close()
.
.
.
End Class
///

Use "Application.ExitThread" to quit the application (unload the forms
first).

Regards,
Herfried K. Wagner
--
MVP · VB Classic, VB .NET
http://www.mvps.org/dotnet


Bob

unread,
Jul 6, 2003, 10:25:03 PM7/6/03
to
Both of you guys rule! Thanks for the help!

flo

unread,
Jul 7, 2003, 3:56:25 AM7/7/03
to
Did you try to close the old form just after opening the
new one like that :
Private Sub Commande0_Click()
DoCmd.OpenForm "Menu Gestion des prêts", , , , ,
acWindowNormal
DoCmd.Close acForm, Me.Name, acSavePrompt
End Sub

>.
>

Bob

unread,
Jul 8, 2003, 4:49:56 PM7/8/03
to
"Armin Zingler" <az.n...@freenet.de> wrote in message
news:ONfSp3AR...@TK2MSFTNGP10.phx.gbl...

> "Bob" <b...@bobber.com> schrieb
> > Does anyone have any simple code for having a form, upon executing
> > an ME.CLOSE statement, open another form and pass control to it,
> > forever forgetting about the original form? Any help is
> > appreciated.
>
> Shared Sub Main()

Hi Armin,

Just curious: Why does this Sub HAVE to be named "Main"? It doesn't work
any other way. I'm assuming Main is some sort of a special class?

Thanks!

Armin Zingler

unread,
Jul 8, 2003, 6:59:05 PM7/8/03
to
"Bob" <b...@bobber.com> schrieb

Each application must have an entry point. The standard is to call it Sub
Main. One might make it more flexible, but there's no reason.


--
Armin

Bob

unread,
Jul 8, 2003, 7:11:43 PM7/8/03
to
"Armin Zingler" <az.n...@freenet.de> wrote in message
> > Just curious: Why does this Sub HAVE to be named "Main"? It doesn't
> > work any other way. I'm assuming Main is some sort of a special
> > class?
>
> Each application must have an entry point. The standard is to call it Sub
> Main. One might make it more flexible, but there's no reason.

I had it named LoadMain(), and for an hour I couldn't get it to work on
another project I am working on. I looked back at when I implemented it for
the splash screen, and changed it back to Main(), and it worked. It
definitely looks like something VB.NET requires for what I am trying to
accomplish. How would you add flexibility in the naming process, anyway?

Armin Zingler

unread,
Jul 8, 2003, 8:04:59 PM7/8/03
to
"Bob" <b...@bobber.com> schrieb

Me? No, the developers of VB.Net :)


--
Armin

0 new messages