Download presentation
Presentation is loading. Please wait.
Published byAmelia Hall Modified over 9 years ago
1
T U T O R I A L 2009 Pearson Education, Inc. All rights reserved. 1 2 Welcome Application Introducing the Visual Basic 2008 Express Edition IDE
2
2009 Pearson Education, Inc. All rights reserved. 2 Outline 2.1 Test-Driving the Welcome Application 2.2 Overview of the Visual Basic 2008 Express Edition IDE 2.3 Creating a Project for the Welcome Application 2.4 Menu Bar and Toolbar 2.5 Visual Basic 2008 Express Edition IDE Windows 2.6 Auto-Hide 2.7 Using Help 2.8 Saving and Closing Projects in Visual Basic
3
2009 Pearson Education, Inc. All rights reserved. 3 In this tutorial you will learn: ■Navigate Visual Studio 2008 ’ s Start Page. ■Create a Visual Basic project. ■Use the IDE ’ s menus and toolbars. ■Manipulate windows in the Visual Basic 2008 Express Edition IDE. ■Use the auto-hide feature. ■Use the Visual Basic 2008 Express Edition IDE ’ s help features. ■Close a Visual Basic project. Objectives
4
2009 Pearson Education, Inc. All rights reserved. 4 ■Visual Studio ® 2008 is Microsoft’s integrated development environment (IDE) for creating, running and debugging applications. ■The IDE allows you to create applications by dragging and dropping existing building blocks into place. ■This technique is called visual programming. Introduction
5
Application Requirements 2009 Pearson Education, Inc. All rights reserved. 5 2.1 Test-Driving the Welcome Application A software company (Deitel & Associates) has asked you to develop a Visual Basic application that displays the message “Welcome to Visual Basic 2008!” and a picture of the company’s bug mascot.
6
2009 Pearson Education, Inc. All rights reserved. 6 Test-Driving the Welcome Application ■Open Windows Explorer and navigate to the C:\Examples\Tutorial02 directory (Fig. 2.1). Contents of C:\Examples\ Tutorial02 Figure 2.1 | Contents of C:\Examples\Tutorial02.
7
2009 Pearson Education, Inc. All rights reserved. 7 ■Double click Welcome.exe (Fig. 2.1) to run the application (Fig. 2.2). Figure 2.2 | Welcome application executing. Close box ■Close your running application by clicking its close box, Test-Driving the Welcome Application (Cont.)
8
2009 Pearson Education, Inc. All rights reserved. 8 ■Many versions of Visual Studio are available. The examples in this book are based on the Microsoft Visual Basic 2008 Express Edition. ■You can also purchase a full version of Visual Studio 2008, which includes support for other languages such as Visual C# and Visual C++. ■To start the IDE, select Start > All Programs > Microsoft Visual Basic 2008 Express Edition. 2.2 Overview of the Visual Basic 2008 Express Edition IDE
9
2009 Pearson Education, Inc. All rights reserved. 9 ■Once the Express Edition begins execution, the Start Page displays (Fig. 2.3). Figure 2.3 | Start Page in Visual Basic 2008 Express Edition with an empty project list. Empty Solution Explorer (no projects open) ■The Start Page contains a list of links to resources in the IDE and on the Internet. 2.2 Overview of the Visual Basic 2008 Express Edition IDE (Cont.) Start Page Start Page links
10
2009 Pearson Education, Inc. All rights reserved. 10 ■The Start Page links are organized into sections: –the Recent Projects section –the Getting Started section, which focuses on using the IDE for creating programs, learning Visual Basic, connecting to the Visual Basic developer community and providing development tools –and the Visual Basic Express Headlines and MSDN: Visual Basic Express Edition sections, which provide links to information about programming in Visual Basic. ■You can browse the MSDN (Microsoft Developer Network) online library at msdn2.microsoft.com/library. 2.2 Overview of the Visual Basic 2008 Express Edition IDE (Cont.)
11
2009 Pearson Education, Inc. All rights reserved. 11 ■You can also browse the web from the IDE using the internal web browser. ■To request a web page, type its URL into the location bar (Fig. 2.4) (If the location bar is not already displayed, select View > Other Windows > Web Browser ). 2.2 Overview of the Visual Basic 2008 Express Edition IDE (Cont.)
12
2009 Pearson Education, Inc. All rights reserved. 12 Figure 2.4 | Displaying a web page in the Visual Basic 2008 Express Edition IDE. Selected tab for requested web page 2.2 Overview of the Visual Basic 2008 Express Edition IDE (Cont.) Requested web page (URL in location-bar drop-down menu)
13
2009 Pearson Education, Inc. All rights reserved. 13 ■Visual Basic organizes applications into projects and solutions. –A project is a group of related files, such as code and images that might make up a program. –Solutions contain one or more projects. 2.3 Creating a Project for the Welcome Application
14
2009 Pearson Education, Inc. All rights reserved. 14 ■There are several ways to create a new project or open an existing one: –Select either File > New Project…, which creates a new project, or File > Open Project…, which opens an existing project. –From the Start Page, under the Recent Projects section, click the link Create: Project… or Open: Project…. –Click either the New Project Button (Fig. 2.5) or the Open File Button (Fig. 2.5). Creating a Project for the Welcome Application
15
2009 Pearson Education, Inc. All rights reserved. 15 Figure 2.5 | New Project button and Recent Projects listing. Creating a Project for the Welcome Application (Cont.) Title bar New Project button Open File button Recent Projects listing
16
2009 Pearson Education, Inc. All rights reserved. 16 Figure 2.6 | New Project dialog. Creating a Project for the Welcome Application (Cont.) ■Visual Basic provides templates for a variety of projects (Fig. 2.6). Templates are the project types you can create in Visual Basic. ■Select Windows Forms Application. Default project name (provided by Visual Basic)
17
2009 Pearson Education, Inc. All rights reserved. 17 Figure 2.7 | New Project dialog with updated project information. Creating a Project for the Welcome Application (Cont.) ■To rename the project, type Welcome in the Name: TextBox (Fig. 2.7). Then click OK. Visual Basic Windows Forms Application (selected) Updated project name
18
2009 Pearson Education, Inc. All rights reserved. 18 Figure 2.8 | Save Project dialog. Creating a Project for the Welcome Application (Cont.) ■Save this project in your C:\SimplyVB2008 directory. To change the project’s location, select File > Save All (Fig. 2.8).
19
2009 Pearson Education, Inc. All rights reserved. 19 Figure 2.9 | Project Location dialog. Creating a Project for the Welcome Application (Cont.) ■Use the Browse… Button to locate your SimplyVB2008 directory (Fig. 2.9). After providing the project’s name and location in the Save Project dialog, click Save. SimplyVB2008 directory (selected) Select Folder Button
20
2009 Pearson Education, Inc. All rights reserved. 20 Creating a Project for the Welcome Application (Cont.) ■The name of each open file is listed on a tab. ■To view a file, click its tab (Fig. 2.10). Figure 2.10 | Design view of the IDE. Properties window Menu bar Active tab Form (Windows application) titled Form1 Solution Explorer Tabs
21
2009 Pearson Education, Inc. All rights reserved. 21 Creating a Project for the Welcome Application (Cont.) ■The content of the Form1.vb [Design] tab is the Windows Form Designer. ■The Form (titled Form1 ) represents the main window of the Windows Forms application.
22
2009 Pearson Education, Inc. All rights reserved. 22 Creating a Project for the Welcome Application (Cont.) ■GUI controls aid both in data entry by users and in formatting and presenting data outputs to users. ■For example, Internet Explorer (Fig. 2.11) displays web pages requested by users.
23
2009 Pearson Education, Inc. All rights reserved. 23 Figure 2.11 | Internet Explorer window with GUI controls labeled. (Web site content courtesy of Deitel & Associates, Inc.) Creating a Project for the Welcome Application (Cont.) Title bar (Label) Menu bar Toolbar Web site requested by the user Menu (Help) ComboBox Drop-down arrowButton (displaying an icon)
24
2009 Pearson Education, Inc. All rights reserved. 24 Figure 2.12 | Visual Basic 2008 IDE menu bar. 2.4 Menu Bar and Toolbar ■Menus contain commands for managing the IDE and for developing and executing applications. ■The set of menus displayed (Fig. 2.12) depends on what you are currently doing in the IDE.
25
2009 Pearson Education, Inc. All rights reserved. 25 Figure 2.13 | Visual Basic IDE menu summary. 2.4 Menu Bar and Toolbar (Cont.) ■Each menu has a group of related commands (also called menu items) that cause the IDE to perform specific actions (Fig. 2.13).
26
2009 Pearson Education, Inc. All rights reserved. 26 2.4 Menu Bar and Toolbar (Cont.) ■You can access many common commands from the IDE toolbar (Fig. 2.14). –The toolbar contains icons that graphically represent commands. –To execute a command via the IDE toolbar, simply click its icon. Figure 2.14 | IDE toolbar. Down arrow indicates additional commands are available Keyboard shortcuts Toolbar icon indicates a command to open a project Toolbar
27
2009 Pearson Education, Inc. All rights reserved. 27 Figure 2.15 | Tooltip demonstration. ■Positioning the mouse pointer over an icon highlights it and, after a brief pause, displays a description of the icon called a tooltip (Fig. 2.15). 2.4 Menu Bar and Toolbar (Cont.) Tooltip displayed when the mouse pointer has rested on the icon for a few seconds
28
2009 Pearson Education, Inc. All rights reserved. 28 Figure 2.16 | Toolbar icons for four Visual Basic IDE windows. ■The IDE provides windows for accessing project files and for customizing forms and controls. ■You can access these windows by using the IDE toolbar icons (Fig. 2.16) or by selecting the window name, using the View menu. 2.5 Visual Basic 2008 Express Edition IDE Windows Properties icon Object Browser icon Toolbox iconSolution Explorer icon
29
2009 Pearson Education, Inc. All rights reserved. 29 Figure 2.17 | Solution Explorer with an open project. Solution Explorer ■The Solution Explorer window (Fig. 2.17) displays a list of the files in a project and the projects in a solution. ■If the Solution Explorer window is not shown in the IDE, you can display it by selecting View > Solution Explorer. 2.5 Visual Basic 2008 Express Edition IDE Windows (Cont.) Properties window icon Show All Files icon Form file Toolbar Project name
30
2009 Pearson Education, Inc. All rights reserved. 30 Figure 2.18 | Using the Show All Files icon to display all the files in a solution. ■Click the Show All Files icon (Fig. 2.18) to display all the files in the solution. 2.5 Visual Basic 2008 Express Edition IDE Windows (Cont.) Collapsed node (plus box expands node to show related files when clicked) ■For your single-project solution, Welcome is the only project. The Form file is named Form1.vb.
31
2009 Pearson Education, Inc. All rights reserved. 31 Figure 2.19 | Expanded node. ■After clicking the Show All Files icon, click the plus box to the left of the My Project folder (Fig. 2.19) to expand the node. Navigating a Project with the Solution Explorer Expanded node (minus box)
32
2009 Pearson Education, Inc. All rights reserved. 32 ■After clicking the Show All Files icon, click the plus box to the left of the My Project folder (Fig. 2.19) to expand the node. Navigating a Project with the Solution Explorer (Cont.) Figure 2.20 | Collapsed node. Collapsed node (plus box)
33
2009 Pearson Education, Inc. All rights reserved. 33 Navigating a Project with the Solution Explorer (Cont.) Figure 2.21 | Toolbox displaying the contents of the Common Controls tab. Group names Controls Additional group names Toolbox ■Using visual programming, you can “drag and drop” controls onto the Form. ■If the Toolbox is not visible, select View > Toolbox. ■The Toolbox (Fig. 2.21) groups controls into categories.
34
2009 Pearson Education, Inc. All rights reserved. 34 Properties Window ■The Properties window (Fig. 2.22) displays an object’s attributes, such as its size, color and position. ■The Properties window allows you to set object properties visually without writing code. ■If the Properties window is not visible, select View > Properties Window (or press F4). Navigating a Project with the Solution Explorer (Cont.)
35
2009 Pearson Education, Inc. All rights reserved. 35 Navigating a Project with the Solution Explorer (Cont.) Figure 2.22 | Properties window displaying a Form ’s properties. Object’s name (Form1) Object’s class (System.Windows.Forms.Form) Down arrow for selecting Form or control objects Toolbar Items that have been changed from their default values (by the user or by Visual Studio) are listed in bold Scrollbox Scrollbar Property values (right column) Properties (left column) Description of selected property Design category Selected property Alphabetical icon Categorized icon Component object box
36
2009 Pearson Education, Inc. All rights reserved. 36 ■At the top of the Properties window is the component object box, which displays each object’s name and class type. ■Icons on the toolbar sort the properties either alphabetically or categorically. ■Each gray horizontal bar to the left of the scrollbar is a category that groups related properties. ■The left column of the Properties window lists the object’s property names; the right column displays each property’s value. ■Whenever you select a property, a description of the property displays at the bottom of the Properties window. Navigating a Project with the Solution Explorer (Cont.)
37
2009 Pearson Education, Inc. All rights reserved. 37 ■Auto-hide is enabled by clicking the window’s vertical pin icon. ■The toolbar along one of the edges of the IDE contains one or more tabs, each of which identifies a hidden window (Fig. 2.23) and displays the window when clicked (Fig. 2.24). Using Auto-Hide Figure 2.23 | Hidden-window tabs. Tab for hidden window Figure 2.24 | Displaying a hidden window with auto-hide enabled. Mouse pointer over the tab for the Toolbox Horizontal pin icon (auto- hide enabled) Toolbox is displayed when the mouse pointer is placed on the tab for the Toolbox Title bar
38
2009 Pearson Education, Inc. All rights reserved. 38 ■Move the mouse pointer outside the Toolbox window’s area to hide the Toolbox (Fig. 2.25). Figure 2.25 | Hiding the Toolbox by moving the mouse pointer outside of the Toolbox ’s area. Mouse pointer over the tab for the Toolbox (Toolbox window is hidden) Using Auto-Hide (Cont.)
39
2009 Pearson Education, Inc. All rights reserved. 39 ■To disable auto-hide click the pin icon in the title bar. ■When a window is “pinned down,” the pin icon is vertical (Fig. 2.26) ■When auto-hide is enabled, the pin icon is horizontal. Figure 2.26 | Pin icon in vertical position. Vertical pin icon (auto-hide is disabled) Using Auto-Hide (Cont.)
40
2009 Pearson Education, Inc. All rights reserved. 40 ■ Help provides a list of articles pertaining to the “current content.” ■The help window also provides help topics, code samples and “Getting Started” information (Fig. 2.27). Figure 2.27 | Help menu commands. Using Auto-Hide (Cont.)
41
2009 Pearson Education, Inc. All rights reserved. 41 ■Visual Basic also provides context-sensitive help, which displays relevant help articles (Fig. 2.28). ■To use context-sensitive help, click an item, then press the F1 key. Using Auto-Hide (Cont.)
42
2009 Pearson Education, Inc. All rights reserved. 42 Figure 2.28 | Context-sensitive help window. Using Auto-Hide (Cont.) Selected item (Windows form) Relevant help article Context-sensitive help window How Do I SearchIndexContents Toolbar
43
2009 Pearson Education, Inc. All rights reserved. 43 Once you’re finished with a project, you should save the project’s files and close the project. ■Before closing the project for the Welcome application, you should save its files, ensuring that any changes made to the project are not lost. ■Although you did not make any changes, save your project files by selecting File > Save All. ■Select File > Close Project. 2.8 Saving and Closing Projects in Visual Basic
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.