473,387 Members | 1,844 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

A Solution's Start Up Object

Usinb VS2003, VB.net, MSDE...

Is there any advantage to these three alternatives as the start up object in
the solution property pages for a winform solution on a stand alone desktop?
1 - Sub Main in module that starts WinForm_Main
2 - Shared Sub Main in WinForm_Main itself
3 - Using WinForm_Main as start up object with no Sub Main anywhere

I have seen sample programs use all 3 of these, and I am not sure what the
best practice is. It seems to be that a Sub Main (or Shared Sub Main with
form load empty) is the best approach, since you could try/catch there,
essentially catching all uncaught exceptions (I am not sure where you would
do that if WinForm_Main were the start up object).

I don't see any difference in Sub Main being in the WinForm_Main or a
seperate module.

What are the pros and cons, if any? Any URL to such an info would be
appreciated.

Thanks!
Bob Day

Nov 20 '05 #1
4 2671
In article <u0*************@TK2MSFTNGP12.phx.gbl>, Bo****@TouchTalk.net
says...
Is there any advantage to these three alternatives as the start up object in
the solution property pages for a winform solution on a stand alone desktop?
1 - Sub Main in module that starts WinForm_Main
2 - Shared Sub Main in WinForm_Main itself
3 - Using WinForm_Main as start up object with no Sub Main anywhere


I can't really think of one advantage over the other. I guess it
depends on the situation.

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 20 '05 #2
* "Bob Day" <Bo****@TouchTalk.net> scripsit:
Usinb VS2003, VB.net, MSDE...

Is there any advantage to these three alternatives as the start up object in
the solution property pages for a winform solution on a stand alone desktop?
1 - Sub Main in module that starts WinForm_Main
2 - Shared Sub Main in WinForm_Main itself
3 - Using WinForm_Main as start up object with no Sub Main anywhere


It's just a matter of personal preference. I always write a shared 'Sub
Main' inside a class called 'AppMain', but sometimes that's not even
necessary if there is nothing to process prior to showing the first form.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #3
Hi Bob,

Thanks for posting in the community.
1 - Sub Main in module that starts WinForm_Main
2 - Shared Sub Main in WinForm_Main itself
3 - Using WinForm_Main as start up object with no Sub Main anywhere


I agree with Patrick and Herfried's suggestion, the three methods are used
according to the suituation.
If you wants to do some initialization stuff before the run the winform,
you may need to use the method 1 or 2, otherwise you can use the method 3
directly.

If you have any concern on this issue,please post here.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #4
Cor
Hi Peter,

There are now 3 questions in top of the newsgroup
microsoft.public.dotnet.general from which I thought you know the answer.

It is about installing VS.net

Cor
Nov 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Federico G. Babelis | last post by:
Hi All: I have this line of code, but the syntax check in VB.NET 2003 and also in VB.NET 2005 Beta 2 shows as unknown: Dim local4 As Byte Fixed(local4 = AddressOf dest(offset)) ...
3
by: Mark Turney | last post by:
Problem: I have a vector full of two different derived class objects (class B and class C) that are derived from the same base class A. I want to loop through vector and invoke a member function...
7
by: Brad | last post by:
When debugging my current web project, in VS2003, I found I had lost the ability to drill down on watch objects in the Watch Window; I could only view the single value specific watch objects. ...
41
by: JohnR | last post by:
In it's simplest form, assume that I have created a usercontrol, WSToolBarButton that contains a button. I would like to eventually create copies of WSToolBarButton dynamically at run time based...
18
by: JohnR | last post by:
From reading the documentation, this should be a relatively easy thing. I have an arraylist of custom class instances which I want to search with an"indexof" where I'm passing an instance if the...
7
by: multicherry | last post by:
Hi, Having searched for a way to fetch a window object by name, all I came across were answers along the line of... "All you have to do is say windowObj = window.open("blah", "name");" which...
2
by: martin1 | last post by:
Hi, All, I used to right click on solution explorer to setup start point, but when I right click and cannot see setup start point anymore. I have 2 window forms and want to set up one window...
3
by: rajibnsu | last post by:
While searching for capturing video with a webcam I god the following code.It gives two errors.Says:The type or namespace name 'WebcamEventArgs' does not exit in the namespace 'WebCam_Capture' (are...
2
by: vijayrvs | last post by:
SearchCrawler.java The program search crawler used to search the files from the website. From the following program i got 7 compiler error. can any body clarify it and provide me solution. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.