Form startup

M

Mark

I want my project to be a Windows Forms Application but upon startup, I want
to check a few files to see if they exist and if they don't, I do not want
the startup form to load. I just want the program to quit. If you have to
start this type of application with a form, how do you keep the form from
displaying?
 
J

James Hahn

You can put a dummy statement in all of the likely suspects and then start
the program in single step debug mode and see the exact order. Just be
careful not to choose something that gets fired again while the program is
running, or you will be performing the checks all over again.

If you terminate the program before the Load event finishes then the form
won't be shown.
 
M

Miha Ambroz

Mark wrote:

I want my project to be a Windows Forms Application but upon startup, I want
to check a few files to see if they exist and if they don't, I do not want
the startup form to load. I just want the program to quit. If you have to
start this type of application with a form, how do you keep the form from
displaying?

You can enable My.Application events (by checking "Enable application
framework" on the "Appliction" tab in project properties) and put your
check-for-files code into the "MyApplication_Startup" event procedure.
Regards,
 
A

Armin Zingler

Mark said:
I want my project to be a Windows Forms Application but upon startup, I want
to check a few files to see if they exist and if they don't, I do not want
the startup form to load. I just want the program to quit. If you have to
start this type of application with a form, how do you keep the form from
displaying?

Translate what you said into VB and put it in Sub Main. Set Sub Main as
the project's startup object after disabling the "application framework".


Armin
 
M

Maverick

I recommend "Miha Ambroz" option
I mworking in vb 2005 for about 2 and a half years now and the
ApplcationStartup_Event should be the place to put such codes.
because by the time your application is in startup event it process,
It doesn't create the startup form object.

Regards,
Haroon.
Software Architect
 

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