How to Design a Windows Forms Application - How to create a new project
(Page 2 of 5 )
To create a new project, you use the New Project dialog box shown in figure 2-2. This dialog box lets you select the type of project you want to create by choosing one of several templates. To create a Windows Forms application, for example, you select the Windows Forms Application template. Among other things, this template includes references to all of the assemblies that contain the namespaces you’re most likely to use as you develop a Windows application.
The New Project dialog box also lets you specify the name for the project, and it lets you identify the folder in which it will be stored. By default, projects are stored in the Visual Studio Projects folder under the My Documents folder, but you can change that as shown in the previous figure.
If you want to change the location that’s shown in the New Project dialog box, you can click the Browse button to select a different location; display the drop-down list to select a location you’ve used recently; or type a path directly. If you specify a path that doesn’t exist, Visual Studio will create the necessary folders for you.
When you click the OK button, Visual Studio automatically creates a new folder for the project, using the project name you specify. In the dialog box in this figure, for example, InvoiceTotal is the project name and C:\VB 2008 is the location. By default, Visual Studio also creates a new folder for the solution, using the same name as the project. As a result, Visual Studio will create one folder for the solution, and a subfolder for the project.
If that’s not what you want, though, you can deselect the Create Directory For Solution check box. Then, the solution is given the same name as the project and is stored in the same folder. This makes sense for solutions that contain just one project. Because most of the solutions in this book contain only one project, that’s the way most of the applications for this book are set up.
Incidentally, the terms folder and directory are used as synonyms throughout this book. With the introduction of Windows 95, Microsoft started referring to directories as folders. But most of the Visual Studio documentation still uses the term directory. That’s why this book uses whichever term seems more appropriate at the time.
By default, the new projects you create target .NET Framework 3.5 so that you can use the features it provides. If you use any of these features, however, any computer that you want to run the application on must also have .NET Framework 3.5. If that’s not the case, you can change the target framework using the drop-down list in the upper right corner of the New Project dialog box. You can select .NET Framework 2.0, 3.0, or 3.5 from this list. Note that if you set the target framework to 3.0 or 3.5, you can still run the application on a computer that doesn’t have the specified framework as long as the application doesn’t use any features of that framework. However, it’s best to set the target framework appropriately for the computers where the application will run so that you don’t accidentally use a feature that isn’t supported.
The New Project dialog box
How to create a new Visual Basic project
Use the File->New Project command to open the New Project dialog box.
Choose Visual Basic as the Project Type, and choose the Windows Forms Application template for a Windows Forms application.
Enter a name for the project. Then, enter the location (folder) for the project (and solution).
If you want the solution file and the project file to be stored in the same directory, uncheck the Create Directory for Solution box.
Click the OK button to create the new project.
Description
- The project template that you select determines the initial files, assembly references, code, and property settings that are added to the project.
- If the Create Directory For Solution box is checked, Visual Studio creates one folder for the solution and a subfolder for the project. Otherwise, these files are stored in the same folder.
- If the Save New Projects When Created option is on as shown in the previous figure, the project is saved right after it’s created. Otherwise, the New Project dialog box asks only that you select a template and enter a name for the project. Then, when you save the project, the Save Project dialog box asks for the other information shown above.
- If you want to target a version of the .NET Framework other than version 3.5, you can select the version from the drop-down list in the upper right corner of the dialog box.
Figure 2-2. How to create a new project
Next: How to design a form >>
More Visual Basic.NET Articles
More By Murach Publishing
|
This article is excerpted from chapter two of Murach's Visual Basic 2008, written by Anne Boehm (Murach, 2008; ISBN: 1890774456). Check it out today at your favorite bookstore. Buy this book now.
|
|