List Info

Thread: Best way to run pre-form load code on startup




Best way to run pre-form load code on startup
user name
2006-03-28 19:26:22
I am new to this list and new to .net.  I have been using
VB6 for years.  I
now have VS 2005.

In VB6, I could set the startup code to be Sub Main in a
module.  In Sub
Main, I would always initialize a lot of my hardware
(industrial equipment
and I/O) before loading the first form.  I would also
explicitly instantiate
the form objects and set the object to Nothing when I was
done with the
form.  I don't see the parallel in .Net.  I know forms are
still objects,
but how do instantiate the first one if I can't have a Sub
Main?

What is the best way to initialize hardware on startup?  In
the New event of
the startup form?

I have looked through the DotNet SDK and watched some
training videos, but
nothing ever really answered this question.  I have more
training videos and
books on the way, but I wanted to get started now.

Thanks in advance for your help,
Kelly

===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Best way to run pre-form load code on startup
user name
2006-03-28 20:12:13
Kelly,

        You can have a sub main, but not if you use the
application
framework ("My" namespace, this is new in 2005).
The "Main" form is created
automatically when it is the start up object, all other
forms will need to
be created.

        I have a "StartUp" routine that I call
from within the form_load
event that creates all of my class instances, reads in
settings, starts
logging, etc. (All the stuff I did in ModMain in VB6 and
.NET 2003)

HTH
Rob

-----Original Message-----
From: Discussion of writing applications and components
using Visual Basic
.NET [mailto:VBDOTNETDISCUSS.DEVELOP.COM] On Behalf Of Kelly
Baker
Sent: Tuesday, March 28, 2006 2:26 PM
To: VBDOTNETDISCUSS.DEVELOP.COM
Subject: [VBDOTNET] Best way to run pre-form load code on
startup

I am new to this list and new to .net.  I have been using
VB6 for years.  I
now have VS 2005.

In VB6, I could set the startup code to be Sub Main in a
module.  In Sub
Main, I would always initialize a lot of my hardware
(industrial equipment
and I/O) before loading the first form.  I would also
explicitly instantiate
the form objects and set the object to Nothing when I was
done with the
form.  I don't see the parallel in .Net.  I know forms are
still objects,
but how do instantiate the first one if I can't have a Sub
Main?

What is the best way to initialize hardware on startup?  In
the New event of
the startup form?

I have looked through the DotNet SDK and watched some
training videos, but
nothing ever really answered this question.  I have more
training videos and
books on the way, but I wanted to get started now.

Thanks in advance for your help,
Kelly

===================================
This list is hosted by DevelopMentorR  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com


===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )