1 visual basic.net application overview. 2 objectives discuss what a typical visual basic.net...
Post on 20-Dec-2015
220 views
TRANSCRIPT
2
Objectives
• Discuss what a typical Visual Basic .NET application looks like
• Configure the Visual Studio .NET Integrated Development Environment for developing applications in Visual Basic .NET
• Create and open a Visual Studio .NET solution and project
• Create a blank solution and add a new project
3
Previewing the VillageHousing Application
• VillageHousing application– Stored in the VB.NET\Student\Tut00\ VillageHousing
folder– Consists of one Windows Form with a Microsoft
Access database as the back end
4
To View the VillageHousing Application
1. Click the Start button on the Windows taskbar, click Run on the Start menu to open the Run dialog box, and then click Browse to open the Browse dialog box
2. Locate and then open the VB.NET\Student\Tut00\VillageHousing\bin folder. Click VillageHousing.exe in the list of filenames, and then click Open. Click OK
3. Note some of the user-interface features of this application. On the left side, buttons, labels, and text boxes are all neatly aligned. Click the First Name text box, and then press Tab several times; the focus shifts in a spatially logical pattern (left to right, top to bottom) from control to control throughout the form
6
To View the VillageHousing Application(Continued)
4. Try to click the BadgeID text box. You cannot move the focus to this text box because BadgeID has been disabled in the form
5. The Help button at the upper left of the form explains how to use the application. Click Help to open a Help window outlining basic information on the application
6. Click OK to close the VillageHousing Help window
8
To Experiment with the VillageHousing Project
1. Load the data by clicking the Load button
2. Note that the navigation buttons are now enabled. Scroll through the records of villagers already registered in the database. Click the arrow in the Find by Last Name combo box, and click Able. Click Find by BadgeID, type 10, and then click OK. Ivan Turkovitch’s record appears. Click Find by BadgeID again, type 70, and then click OK. Click OK, and note that the first record is displayed
10
To Experiment with the VillageHousing Project (Continued)
3. Make a room reservation by typing the indicated RoomID for the following villagers
• BadgeID=14, Gerhard Werner, RoomID=10• BadgeID=15, Andrea Schmitz, RoomID=98
4. Change the RoomID for David Simpson, BadgeID=1, from 50 to 92
5. Add the following villagers. Click Add, and type into the text boxes, using Tab to move from text box to text box
• Sally Petersen, 2/10/1969, USA, Athlete, Equestrian, F, RoomID=110
• Sven Bjoernsen, 3/16/1980, SWE, Athlete, Track, M, no room
11
To Experiment with the VillageHousing Project (Continued)
6. Locate the villager with BadgeID 15, and click Delete. Then delete Miguel Jacinto
7. Click Update to record all of your changes to villager records stored in the database, and then click Load again
8. Click the Close button to close the VillageHousing application
12
Configuring Visual Studio .NET
• Visual Studio .NET – Supports application development in roughly 20
programming languages– Select settings in the Visual Studio .NET Integrated
Development Environment (IDE) appropriate for a Visual Basic .NET developer
13
To Start Visual Studio .NET and Customize it for Visual Basic .NET Development
1. Click Start on the Windows taskbar, point to Programs (All Programs in Windows XP), point to Microsoft Visual Studio .NET, and then click Microsoft Visual Studio .NET
2. In the left pane of the Start Page, click My Profile
15
To Start Visual Studio .NET and Customize it for Visual Basic .NET Development (Continued)
3. In the Profile combo box, look at all the options in the drop-down list, and then click Visual Basic Developer
4. In the Keyboard Scheme list box, click Visual Basic 6, if necessary
5. In the Window Layout list box, click Visual Studio Default, if necessary
6. In the Help Filter list box, click Visual Basic, if necessary
7. In the At Startup list box, you can make whatever choice is most comfortable for you. In this situation, click the default, Show Start Page
16
Creating and Opening a Visual Basic .NET Solution and Project
• Solution – A container for one or more projects
• Project– Consists of a computer program and related components,
written in one of the programming languages supported by the Visual Studio .NET platform
• Files that constitute a project– Stored in the solution container
• Solutions that you create– Consist of a single Visual Basic .NET project
• Solution and project refer to the same Visual Basic .NET application
17
To create a New Project and Solution
1. Click Get Started on the Start Page, and then click New Project
2. In the New Project dialog box, click Visual Basic Projects under Project Types, if necessary
3. Under Templates, click Windows Application, if necessary. When creating a new project, you need to provide a name and location for storing the project and related files
19
To Create a New Project and Solution (Continued)
4. Double-click the Name text box to select the default name, and then type Hello1
5. In the Location textbox, type VB.NET\Student\Tut00. Note that Visual Studio informs you that the project will be created at VB.NET\Student\Tut00\Hello1
6. Click OK to close the dialog box and finish creating the new project and solution
7. Next, run the newly created program. To do this, click Debug | Start from the main menu. Alternatively, click the Start button. Visual Basic .NET saves the source file, compiles and saves the executable file and then initiates execution of the program
23
To Create a New Project and Solution (Continued)
8. Click the Close button to end the running application. Note that Form1 no longer appears on the taskbar. Now close the solution
9. Return to the Visual Studio .NET IDE if necessary, then click File | Close Solution. Note that the Solution Explorer window is empty
25
To Open the Solution Using the File Menu
1. From the Start Page, click File on the menu bar, and then click Open Solution. The Open Solution dialog box opens. In the Open Solution dialog box, the folders that appear depend on your previous use of the Open Solution dialog box. If necessary, navigate to the VB.NET\Student\Tut00 folder
2. Double-click the Hello1 folder, and then double-click the solution file Hello1.sln
3. Close the solution by clicking File | Close Solution. Again, note that Solution Explorer is empty
27
To Open an Existing Project
1. From the Start Page, click the Open Project button on the lower center of the page. The Open Project dialog box opens. In the Open Project dialog box, just as in the Open Solution dialog box, the folders that appear depend on your previous use of the Open Project dialog box. If necessary, navigate to the VB.NET\Student\Tut00 folder
2. Double-click the Hello1 folder, and then double-click the project file Hello1.vbproj. If Solution Explorer is not visible, make it visible by clicking its tab or by clicking View | Solution Explorer. See that both the solution and the project are listed
3. Click File | Open | Project
29
To Open an Existing Project (Continued)
4. At this time, you are not actually opening another project or solution, nor adding a project to the current solution. Click Cancel to close the Open Project dialog box
5. Exit Visual Studio .NET, and then open Visual Studio .NET again. On the Start Page, the Hello1 project is listed at the top of the recent projects list
31
Creating a Blank Solution and Adding a New Project
• To create a blank solution and new project:
1. From the Start Page, click File | New | Blank Solution. Visual Studio Solutions is selected by default for the Project Types, and Blank Solution is the only available template. Note that this solution will be created in the VB.NET\Student\Tut00\Solution1 folder
2. Click OK
3. Click File | Add Project | New Project. Notice the default project name, WindowsApplication1, and that this new project will be stored in the VB.NET\Student\Tut00\Solution1\WindowsApplication1 folder
4. Click OK to accept the default filename and storage location
5. Click the Close button to exit Visual Studio .NET
35
To View the Solutions in Windows Explorer
1. Open Windows Explorer and locate the Tut00 folder on your computer. Click View | Details. In the left pane of Windows Explorer, click the plus box next to the Tut00 folder, then click the plus boxes next to the Hello1 folder and the Solution1 folder. Click the Hello1 folder, and view its contents
2. In the left pane of Windows Explorer, click the Solution1 folder to display its contents in the right pane
38
Creating a Blank Solution and Adding a New Project
• Note the following when viewing the contents of the Solution1 folder and comparing them to that of the Hello1 folder:– Solution1 folder contains the solution files: Solution1.sln and
Solution1.suo• However, unlike the Hello1 folder, the Solution1 folder contains
another subfolder, WindowsApplication1, which in turn contains all the project files
– VB.NET\Student\Tut00\Solution1\WindowsApplication1\bin is empty
39
Summary
• Visual Basic .NET applications– Can provide solutions for many business information system
requirements. Such applications can include a graphical user interface (GUI)
• The Visual Studio .NET Integrated Development Environment (IDE) – Can be tailored to the needs of a Visual Basic .NET developer
through the My Profile page
• Visual Studio .NET solution– Container for one or more Visual Studio .NET projects