Download presentation
Presentation is loading. Please wait.
Published byWalter Gordon Modified over 9 years ago
1
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 4 I Need a Tour Guide
2
Clearly Visual Basic: Programming with Visual Basic 2008 Objectives Create a Visual Basic 2008 Windows application Use the Label and PictureBox tools to add a control to a form Set the properties of an object Save a solution 2
3
Clearly Visual Basic: Programming with Visual Basic 2008 Objectives (continued) 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 3
4
Clearly Visual Basic: Programming with Visual Basic 2008 OK, the Algorithm is Correct. What’s Next? 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 4
5
Clearly Visual Basic: Programming with Visual Basic 20085
6
Creating a Visual Basic Windows Application Windows applications in Visual Basic –Composed of solutions, projects, and files Solution –Can contain several projects Project –Container that stores files associated with project 6
7
Clearly Visual Basic: Programming with Visual Basic 20087 My Wizard Quick Start Create a folder in C:\users\yourName\ called VB Before you create your first application click on TOOLS- OPTIONS Go to Projects and solutions Visual Studio Project Locations: C:\users\you\VB User Templates: C:\users\you\VB Item Templates: C:\users\you\VBC:\users\yourName\ Check the following: Always show Error list Item in Solution Explorer Track Active Item in Solution Explorer Always show Solution Save New Projects when created Create a new VB Window Application Name it My Wizard Project Pin the Control Toolbar and Properties Window (Properties window is Alphabetic) Name the Form1 Text property: Wizard Application
8
Clearly Visual Basic: Programming with Visual Basic 20088
9
9
10
So Many Windows You will find it easier to work in the IDE if: –You either close or auto-hide the windows you are not currently using Auto Hide button –Toggle button: clicking it once activates it; clicking it again deactivates it 10
11
Clearly Visual Basic: Programming with Visual Basic 200811
12
Clearly Visual Basic: Programming with Visual Basic 2008 Creating the User Interface 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 12
13
Clearly Visual Basic: Programming with Visual Basic 200813
14
Clearly Visual Basic: Programming with Visual Basic 2008 Creating the User Interface (continued) 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 14
15
Clearly Visual Basic: Programming with Visual Basic 200815
16
Clearly Visual Basic: Programming with Visual Basic 2008 Save, Save, Save 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 Mini Quiz 1. A ____ control displays text that the user is NOT allowed to edit while an application is running 2. The _________ contains the toos you use to add objects to a form 3. GUI stands for _____________________ 16
17
Clearly Visual Basic: Programming with Visual Basic 2008 Whose Property Is It? Properties –Determine object’s appearance and behavior Name and current value of each property –Appear in the Properties window when the object is selected Select the Form –Change the Text Property to Wizard Application –Change StartPosition to Center Screen –Change font to Segoe 9 Point 17
18
Clearly Visual Basic: Programming with Visual Basic 200818 Change the Properties Window to Alphabetical
19
Clearly Visual Basic: Programming with Visual Basic 2008 Whose Property Is It? (continued) 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 19
20
Clearly Visual Basic: Programming with Visual Basic 2008 Using the Format Menu Format menu –Provides several options for manipulating controls in the interface Exercises –Make the PictureBox1 control the same size as the PictureBox2 control –Align the top borders of the two picture boxes –Click the task box and Choose Image find the images and import them to the screen –Wizard 1 –Size Mode = Stretch –Wizard 2- Size Mode = Auto Size 20
21
Clearly Visual Basic: Programming with Visual Basic 200821 Change Label1’s text property to Wizard 1 and Label2’s Text Property to Wizard 2 Change the Location property of Wizard 1 to 40,212 and the location property of Wizard 2 to 175, 212
22
Clearly Visual Basic: Programming with Visual Basic 2008 Lock Them Down Locking the controls –Prevents them from being moved inadvertently as you work in the IDE Unlock and then lock the controls Right Click the Form and Choose Lock Controls 22
23
Clearly Visual Basic: Programming with Visual Basic 200823
24
Clearly Visual Basic: Programming with Visual Basic 2008 OK, Let’s See the Interface in Action You can start an application by: –Clicking Debug on the menu bar and then clicking Start Debugging or –You can simply press the F5 key on your keyboard 24
25
Clearly Visual Basic: Programming with Visual Basic 200825
26
Clearly Visual Basic: Programming with Visual Basic 2008 Closing the Current Solution 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 26
27
Clearly Visual Basic: Programming with Visual Basic 2008 Opening an Existing Solution To open an existing solution –Use the File menu or the Start Page If a solution is already open in the IDE –It is closed before another solution is opened 27
28
Clearly Visual Basic: Programming with Visual Basic 2008 Exiting Visual Studio To exit Visual Studio –Use either the Close button on its title bar or –The Exit option on the File menu 28
29
Clearly Visual Basic: Programming with Visual Basic 2008 Summary 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 29
30
Clearly Visual Basic: Programming with Visual Basic 2008 Summary (continued) Picture boxes –Used to display images on a form Good practice to save a solution every 10 or 15 minutes Form’s StartPosition property –Specifies the position of the form when it first appears on the screen 30
31
Clearly Visual Basic: Programming with Visual Basic 2008 Summary (continued) 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 the form 31
32
32 Mini Quiz 1.The name of the image file assigned to a picture box control is stored in the control’s __________ property 2.The value assigned to a label control’s ______ property appears in side the Control 3.A control’s Location Property specifies the location of the control’s _________ corner on the form 4.How did you make the two picture boxes the same size? 5.To start a VB application, click Debug, and then click _________________ Actually the best way to start a VB program is to press the F5 KEY REVIEW QUESTIONS 1.A Windows form automatically contains: a. Close, Maximize, Minimize buttons b. a default caption c. a title bar d. all of the above 2.To display the text “ABC Company” at the top of your interface, use a: a. Form b. Label C. Picture Box D. None of theses 3.You use the ______ window to set characteristics of an object a. Characteristics b. Designer c. Object d. Properties 4.The ______ property determines the position of a form when it is ran a. StartPosition b. Location c. StartLocation d. InitialPosition 5.When aligning 2 objects, the first control selected is called the: a. initializer b. Positioning c. reference d. none of the these
33
Page 73- #5 Program the Picture Box Clearly Visual Basic: Programming with Visual Basic 200833 Insert the Picture – Lightning_bolts.gif (downloaded earlier) Double click on Each button to Program them The show button: Picturebox1.visible = true The Hide Button: Picturebox1.visible = False The Exit Button Me.Close SEE THE NEXT SLIDE
34
Clearly Visual Basic: Programming with Visual Basic 200834 Page 73-74 Project #5 Double click on each Button: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click PictureBox1.Visible = True End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click PictureBox1.Visible = False End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Me.Close() End Sub
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.