For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic > October 2004 > Sub Main()









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Sub Main()
Andy

2004-10-28, 3:55 pm


Just to make sure:

I have a VB Project that does not contain any Forms or
controls. So I start my Project in Sub Main in the Module.

Do I need to do anything to terminate this Project
since 'Unload Me' will not work in the Module? Is it OK
just to let the code run until it gets to the End Sub in
Sub Main (and that will be the end of the story)?

Makes sense, but I want to make sure that's what should
happen.

---- Andy
YYZ

2004-10-28, 3:55 pm

"Andy" <Andrzej7@hotmail.com> wrote in message
news:1b5e01c4bd04$36ff8210$a601280a@phx.gbl...
>
> Just to make sure:
>
> I have a VB Project that does not contain any Forms or
> controls. So I start my Project in Sub Main in the Module.
>
> Do I need to do anything to terminate this Project
> since 'Unload Me' will not work in the Module? Is it OK
> just to let the code run until it gets to the End Sub in
> Sub Main (and that will be the end of the story)?


Absolutely. If you ever find a situation where it isnt' terminating, then
you have larger problems that you need to fix. I've never seen that in the
situation that you described, though. If you don't have any forms or
controls, it's hard to create a scenario where objects won't let themselves
be closed.

matt


Bob Butler

2004-10-28, 3:55 pm

"Andy" <Andrzej7@hotmail.com> wrote in message
news:1b5e01c4bd04$36ff8210$a601280a@phx.gbl
> Just to make sure:
>
> I have a VB Project that does not contain any Forms or
> controls. So I start my Project in Sub Main in the Module.
>
> Do I need to do anything to terminate this Project
> since 'Unload Me' will not work in the Module? Is it OK
> just to let the code run until it gets to the End Sub in
> Sub Main (and that will be the end of the story)?
>
> Makes sense, but I want to make sure that's what should
> happen.


That's what should happen.

--
Reply to the group so all can participate
VB.Net... just say "No"

Richard Jalbert

2004-10-28, 3:55 pm

On Thu, 28 Oct 2004 08:38:47 -0700, "Andy" <Andrzej7@hotmail.com>
wrote:

>
>Just to make sure:
>
>I have a VB Project that does not contain any Forms or
>controls. So I start my Project in Sub Main in the Module.
>
>Do I need to do anything to terminate this Project
>since 'Unload Me' will not work in the Module? Is it OK
>just to let the code run until it gets to the End Sub in
>Sub Main (and that will be the end of the story)?
>
>Makes sense, but I want to make sure that's what should
>happen.


Funny enough, it works out exactly as that.

Your main shoudl call up a module function from which all other
functions tree out.

When it is finished, the control is returned to the calling sub (the
Main) a nd whan it hits the End Sub, it finishes and unloads itself
from memory.


****************************************
******************************
Richard Jalbert Programmer-Analyst Richmann@sympatico.ca

Dogs have owners, cats have staff.

http://www3.sympatico.ca/richmann/
****************************************
******************************
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com