Renaming Your Initial Module

By default, Visual Studio 2008 names the initial module type of a Console Application using the rather nondescript Module1. If you were to change the name of the module defining your Main() method to a more fitting name (Program, for example), the compiler will generate an error such as the following:

'Sub Main' was not found in 'FunWithModules.Module1'.

In order to inform Visual Studio 2008 of the new module name, you are required to reset the "startup object" using the Application tab of the My Project dialog box, as you see in Figure 3-2. Once you do so, you will be able to compile your application without error.

Figure 3-2. Resetting the module name

Note As a shortcut, you can also rename your initial module by changing the name of the defining file using the Solution Explorer window of Visual Studio. This will automatically "reset" the startup object.

Was this article helpful?

0 0

Post a comment