1 / 34

Clearly Visual Basic: Programming with Visual Basic 2008

Learn how to create a Visual Basic 2008 Windows application, add controls to a form, set object properties, and save solutions. Understand the user interface and the integrated development environment (IDE).

ekelly
Download Presentation

Clearly Visual Basic: Programming with Visual Basic 2008

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 4 I Need a Tour Guide

  2. 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 Clearly Visual Basic: Programming with Visual Basic 2008

  3. 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 Clearly Visual Basic: Programming with Visual Basic 2008

  4. 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 Clearly Visual Basic: Programming with Visual Basic 2008

  5. Clearly Visual Basic: Programming with Visual Basic 2008

  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 Clearly Visual Basic: Programming with Visual Basic 2008

  7. My Wizard Quick Start Create a folder in C:\users\yourName\  called VBBefore you create your first application click on TOOLS- OPTIONSGo to Projects and solutionsVisual Studio Project Locations:  C:\users\you\VB                   User Templates:    C:\users\you\VB                   Item Templates:    C:\users\you\VB                    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 ApplicationName it My Wizard ProjectPin the Control Toolbar and Properties Window (Properties window is Alphabetic)Name the Form1 Text property:  Wizard Application Clearly Visual Basic: Programming with Visual Basic 2008

  8. Clearly Visual Basic: Programming with Visual Basic 2008

  9. Clearly Visual Basic: Programming with Visual Basic 2008

  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 Clearly Visual Basic: Programming with Visual Basic 2008

  11. Clearly Visual Basic: Programming with Visual Basic 2008

  12. 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 Clearly Visual Basic: Programming with Visual Basic 2008

  13. Clearly Visual Basic: Programming with Visual Basic 2008

  14. 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 Clearly Visual Basic: Programming with Visual Basic 2008

  15. Clearly Visual Basic: Programming with Visual Basic 2008

  16. 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 _____________________ Clearly Visual Basic: Programming with Visual Basic 2008

  17. 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 Clearly Visual Basic: Programming with Visual Basic 2008

  18. Change the Properties Window to Alphabetical Clearly Visual Basic: Programming with Visual Basic 2008

  19. 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 Clearly Visual Basic: Programming with Visual Basic 2008

  20. 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 Imagefind the images and import them to the screen • Wizard 1 –Size Mode = Stretch • Wizard 2- Size Mode = Auto Size Clearly Visual Basic: Programming with Visual Basic 2008

  21. Change Label1’s text property to Wizard 1 and Label2’s Text Property to Wizard 2Change the Location property of Wizard 1 to 40,212 and the location property of Wizard 2 to 175, 212 Clearly Visual Basic: Programming with Visual Basic 2008

  22. 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 Clearly Visual Basic: Programming with Visual Basic 2008

  23. Clearly Visual Basic: Programming with Visual Basic 2008

  24. 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 Clearly Visual Basic: Programming with Visual Basic 2008

  25. Clearly Visual Basic: Programming with Visual Basic 2008

  26. 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 Clearly Visual Basic: Programming with Visual Basic 2008

  27. 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 Clearly Visual Basic: Programming with Visual Basic 2008

  28. Exiting Visual Studio • To exit Visual Studio • Use either the Close button on its title bar or • The Exit option on the File menu Clearly Visual Basic: Programming with Visual Basic 2008

  29. 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 Clearly Visual Basic: Programming with Visual Basic 2008

  30. 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 Clearly Visual Basic: Programming with Visual Basic 2008

  31. 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 Clearly Visual Basic: Programming with Visual Basic 2008

  32. Mini Quiz • The name of the image file assigned to a picture box control is stored in the control’s __________ property • The value assigned to a label control’s ______ property appears in side the Control • A control’s Location Property specifies the location of the control’s _________corner on the form • How did you make the two picture boxes the same size? • 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 • A Windows form automatically contains:a. Close, Maximize, Minimize buttons b. a default caption c. a title bard. all of the above • 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 • You use the ______ window to set characteristics of an objecta. Characteristics b. Designer c. Object d. Properties • The ______ property determines the position of a form when it is rana. StartPosition b. Location c. StartLocation d. InitialPosition • 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 Insert the Picture – Lightning_bolts.gif (downloaded earlier) Double click on Each button to Program them The show button: Picturebox1.visible = trueThe Hide Button: Picturebox1.visible = FalseThe Exit Button Me.Close SEE THE NEXT SLIDE Clearly Visual Basic: Programming with Visual Basic 2008

  34. 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 Clearly Visual Basic: Programming with Visual Basic 2008

More Related