Download presentation
Presentation is loading. Please wait.
Published byOswald Hawkins Modified over 9 years ago
1
Chapter 3 I Need a Tour Guide (Introduction to Visual Basic 2010) Clearly Visual Basic: Programming with Visual Basic 2010 2 nd Edition
2
Objectives Clearly Visual Basic: Programming with Visual Basic 2010, 2 nd Edition 2 After studying Chapter 3, you should be able to: Create a Windows application in Visual Basic 2010 Use the Label and PictureBox tools to add controls to a form Set the properties of an object Save a solution
3
Objectives (cont’d.) Clearly Visual Basic: Programming with Visual Basic 2010, 2 nd Edition 3 Size and align objects using the Format menu Lock the controls on a form Start and end an application Close and open an existing solution
4
OK, the Algorithm is Correct. What’s Next? Clearly Visual Basic: Programming with Visual Basic 2010, 2 nd Edition 4 User interface What appears on the screen and with which you interact while using a program Integrated development environment (IDE) Contains the tools and features you need to create, run, and test your programs
5
Clearly Visual Basic: Programming with Visual Basic 2010, 2 nd Edition 5 Figure 3-1 Microsoft Visual Studio 2010 Professional startup screen
6
Clearly Visual Basic: Programming with Visual Basic 2010, 2 nd Edition 6 Figure 3-2 Microsoft Visual Basic 2010 Express startup screen
7
Creating a Visual Basic Windows Application Clearly Visual Basic: Programming with Visual Basic 2010, 2 nd Edition 7 Windows applications in Visual Basic Composed of solutions, projects, and files Solution Can contain several projects Project Container that stores files associated with project
8
Clearly Visual Basic: Programming with Visual Basic 2010, 2 nd Edition 8 Figure 3-3 Options dialog box
9
Clearly Visual Basic: Programming with Visual Basic 2010, 2 nd Edition 9 Figure 3-4 Completed New Project dialog box in Visual Studio 2010 Professional
10
Clearly Visual Basic: Programming with Visual Basic 2010, 2 nd Edition 10 Figure 3-5 Completed New Project dialog box in Visual Basic 2010 Express
11
So Many Windows! Clearly Visual Basic: Programming with Visual Basic 2010, 2 nd Edition 11 You will find it easier to work in the IDE if you: Close or auto-hide the windows you are not currently using Auto Hide button Toggle button Clicking once activates it Clicking again deactivates it
12
So Many Windows! (cont’d.) Clearly Visual Basic: Programming with Visual Basic 2010, 2 nd Edition 12 Figure 3-7 Current status of the windows in the IDE
13
Creating the User Interface Clearly Visual Basic: Programming with Visual Basic 2010, 2 nd Edition 13 Windows Form Designer window Where you create (or design) your application’s user interface Form The foundation for the user interface in a Windows application Automatically includes a title bar that contains a default caption
14
Creating the User Interface (cont’d.) Clearly Visual Basic: Programming with Visual Basic 2010, 2 nd Edition 14 Figure 3-8 Windows Form Designer window
15
Creating the User Interface (cont’d.) Clearly Visual Basic: Programming with Visual Basic 2010, 2 nd Edition 15 Controls Objects added to a form Picture box Displays an image on a form Label controls Display text that user is not allowed to edit while application is running
16
Creating the User Interface (cont’d.) Clearly Visual Basic: Programming with Visual Basic 2010, 2 nd Edition 16 Figure 3-9 Pet Application user interface
17
Save, Save, Save Clearly Visual Basic: Programming with Visual Basic 2010, 2 nd Edition 17 Good practice Save current solution every 10 or 15 minutes To save a solution Click on File on the menu bar, then click Save All
18
Whose Property Is It? Clearly Visual Basic: Programming with Visual Basic 2010, 2 nd Edition 18 Properties Determine object’s appearance and behavior Name and current value of each property Appear in the Properties window when the object is selected Properties window Object box Properties list Two columns: Property names and settings box Description pane
19
Whose Property Is It? (cont’d.) Clearly Visual Basic: Programming with Visual Basic 2010, 2 nd Edition 19 Figure 3-15 Partial listing of the form’s properties
20
Whose Property Is It? (cont’d.) Clearly Visual Basic: Programming with Visual Basic 2010, 2 nd Edition 20 Font General shape of text characters Measured in points Exercises Change the values assigned to some of the form’s properties Change two properties of each label control Change two properties of each picture box
21
Using the Format Menu Clearly Visual Basic: Programming with Visual Basic 2010, 2 nd Edition 21 Format menu Provides several options for manipulating controls in the interface Reference control First selected control Exercises Make the PictureBox1 control the same size as the PictureBox2 control Align the top borders of the two picture boxes
22
Using the Format Menu (cont’d.) Clearly Visual Basic: Programming with Visual Basic 2010, 2 nd Edition 22 Figure 3-19 Both picture boxes selected on the form
23
Lock Them Down Clearly Visual Basic: Programming with Visual Basic 2010, 2 nd Edition 23 Locking the controls Prevents them from being moved inadvertently as you work in the IDE Exercise Unlock and then lock the controls
24
Lock Them Down (cont’d.) Clearly Visual Basic: Programming with Visual Basic 2010, 2 nd Edition 24 Figure 3-20 Controls locked on the form
25
OK, Let’s See the Interface in Action! Clearly Visual Basic: Programming with Visual Basic 2010, 2 nd Edition 25 You can start an application by: Clicking Start Debugging option on the Debug menu or Pressing the F5 key on your keyboard
26
OK, Let’s See the Interface in Action! (cont’d.) Clearly Visual Basic: Programming with Visual Basic 2010, 2 nd Edition 26 Figure 3-21 Result of starting the Pet Application
27
Closing the Current Solution Clearly Visual Basic: Programming with Visual Basic 2010, 2 nd Edition 27 To close a solution Use the Close Solution option on the File menu When you close a solution All projects and files contained in the solution are also closed
28
Opening an Existing Solution Clearly Visual Basic: Programming with Visual Basic 2010, 2 nd Edition 28 To open an existing solution Use Open Project the File menu If a solution is already open in the IDE It is closed before another solution is opened
29
Exiting Visual Studio 2010 or Visual Basic 2010 Express Clearly Visual Basic: Programming with Visual Basic 2010, 2 nd Edition 29 To exit Visual Studio Use either the Close button on its title bar or The Exit option on the File menu
30
Summary Clearly Visual Basic: Programming with Visual Basic 2010, 2 nd Edition 30 Creating the user interface Fourth step in the problem-solving process Windows applications in Visual Basic Composed of solutions, projects, and files Label controls Display text that user is not allowed to edit while an application is running Picture boxes Used to display images on a form
31
Summary (cont’d.) Clearly Visual Basic: Programming with Visual Basic 2010, 2 nd Edition 31 Good practice to save solution every 10-15 minutes Form’s StartPosition property Specifies the position of the form when it first appears on the screen Font property Determines the type, style, and size of font used to display text on the form Picture box control’s Image property Specifies name of file containing the image to display Good practice to lock the controls in place on form
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.