Room for reference
June 01, 2004
  "Error running my first WindowsApplication" - VB.Net One of my friend, who is a VB guy basically recently started learning VB.Net. Yesterday he called me and mentioned that he was getting "Sub Main Was Not Found in WindowsApplication1.Form1" error message while running his first VB.Net application. He just created a Windows application with one form on it and tried to run the form. That's it, he encountered this problem. He was using Visual Studio .Net 2002 edition.

After getting the details of what he did with his new Project, I gave him the below explanation and solution:

The cause for this problem must make the core VB guys to feel wired. This problem would occur If the Name property of the start up form changed. This is not the case in Visual Basic 6.0 or earlier. In those versions even if you change the start up form name (first form by default is the start up form) the application would run without any errors. But VB.Net which is more sensitive and powerful, needs everything to be proper. So in order to avoid the above mentioned error, before running the application make sure that the Startup Object property for the project is updated with the correct form name.

To accomplish that follow these steps:

- Right-click the Startup project in Solution Explorer.
- Click Properties when you receive the context menu.
- The Property Pages dialog box appears.
- Click the General node in the Common Properties node, if it is not already selected.
- Click the Startup Object drop-down list box.
- Select the new name for the Startup Object drop-down list box.
- Click OK.

Listen: You can also open the Property Pages dialog box by clicking Properties on the Project menu, or by pressing the Shift+F4 keys. For this to work, the Startup project should be selected in the Solution Explorer.

Actually this is a bug confirmed by Microsoft and hope this will be fixed in later versions of Visual Studio .Net.

After resolving the problem, he successfully able to run the application and started developing a dummy project while learning VB.Net.

Hope he had a nice sleep with sweet dreams on .NET !!! 


<< Home
a blog on Technology of Microsoft & much more..

My Photo
Name:
Location: Chennai, Tamil Nadu, India
ARCHIVES
May 2004 / June 2004 / July 2004 / August 2004 / September 2004 / October 2004 / September 2005 /


Powered by Blogger