Setting Up a New Windows Project

function OpenWin(url, w, h) { if(!w) w = 400; if(!h) h = 300; window.open(url, "_new", "width=" + w + ",height=" + h + ",menubar=no,toobar=no,scrollbars=yes", true); } function Print() { window.focus(); if(window.print) { window.print(); window.setTimeout('window.close();',5000); } }
Team-Fly    

Special Edition Using Microsoft® Visual Basic® .NET
By Brian Siler, Jeff Spotts
Table of Contents
Chapter 2.  Creating Your First Windows Application


To develop a Visual Basic .NET application, you must first enter the Visual Basic .NET development environment, then set up a project. In Visual Basic terminology, a project acts as a repository for all the files needed to create an application.

Starting Visual Basic .NET

Begin by starting the Visual Basic .NET Integrated Development Environment (IDE). When Visual Basic .NET's IDE opens, you will normally see the Get Started pane of the Visual Studio Start Page, shown in Figure 2.2.

Figure 2.2. A new Visual Basic .NET session displays the Visual Studio Start Page.

graphics/02fig02.gif

Note

If this is the first time you have ever started Visual Basic .NET, you may see the My Profile pane of the Visual Studio Home Page instead of the Get Started pane (see Figure 2.3). If this is the case, simply click the Get Started link on the left side of the page.

Figure 2.3. If you have never started Visual Basic .NET before, you may see a different part of the Visual Studio Start Page.

graphics/02fig03.gif


Creating A New Project

Click the Create New Project button to start a new Visual Basic .NET project. You will be presented with the New Project dialog box, as illustrated in Figure 2.4.

Figure 2.4. The New Project dialog box assists you in the setup of a new project.

graphics/02fig04.gif

As you will learn in the course of reading this book, Visual Basic .NET allows you to create a number of different types of projects. For our example, we will be creating a standard Windows application that can run on the Microsoft Windows platform.

Process the New Project dialog box as follows:

  • In the Project Types box, make sure Visual Basic Projects is selected.

  • In the Templates box, click Windows Application.

  • In the Name text box, type the name by which you want your project to be known. For this example, we'll use the name Loan Calculator.

  • Make sure the Location box contains the path to the folder where you want to store your Visual Studio projects. When Visual Studio .NET is first installed, the default project location is the Visual Studio Projects subfolder of your My Documents folder; however, you can change this location by clicking the Browse button (or by typing a valid path). A subfolder for this new project will be created in that location, as reported just below the Location box ("Project will be created at...").

After you have completed filling out the New Project dialog box, click OK. Visual Basic .NET will create the files needed for your new project, create the appropriate subfolder, and save the project files in that subfolder. You will then see the main Visual Basic .NET design screen, as shown in Figure 2.5.

Figure 2.5. Visual Basic .NET's design screen is where you build your application's user interface.

graphics/02fig05.gif

Notice Visual Basic .NET's title bar;specifically, the word [design] after Microsoft Visual Basic .NET. This means that you are in design mode (also known as design time), a name for the time you spend designing your program. Later, when you run your program, Visual Basic .NET will be in run mode.

As in previous versions of Visual Basic, a new Windows Application project consists of one form, or window, which will typically serve as your program's main user interface. Visual Basic applications are comprised of one or more components, such as forms, code modules, and classes, along with controls and other components.

Look at the Solution Explorer in the upper-right area of the screen in Figure 2.5 and shown in Figure 2.6. It consists of a list of the contents of the current project. Because you've just begun this project, it contains only a single form named Form1.vb. A project can grow to include many components; the Solution Explorer helps keep them organized. The last part of the text in Visual Basic .NET's title bar (Form1.vb [Design]) tells you that Form1 is the current form active in the development environment, and that it, too, is in design mode.

Figure 2.6. The Solution Explorer lists the components that make up a project.

graphics/02fig06.gif

To learn all about Visual Basic .NETs development environment see "Understanding the Development Environment," p. 75

Saving Your Work

Unlike previous versions of Visual Basic, and much to the delight of VB programmers, Visual Basic .NET names and saves the files that comprise a project before you begin working on the project. By default, Visual Basic .NET is set to automatically save your project files whenever you build and/or run a program. You can change this setting in the Projects and Solutions section of the Environment folder in the Options dialog box, which can be accessed by clicking Tools, Options in the menu system.


    Team-Fly    
    Top
     



    Special Edition Using Visual Basic. NET
    Special Edition Using Visual Basic.NET
    ISBN: 078972572X
    EAN: 2147483647
    Year: 2001
    Pages: 198

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net