jagomart
digital resources
picture1_Programming Pdf 185947 | 0136053033


 112x       Filetype PDF       File size 2.80 MB       Source: www.pearsonhighered.com


File: Programming Pdf 185947 | 0136053033
tutorial 3 objectives welcome application in this tutorial you will learn to set the text in the form s title bar introduction to visual programming change the form s background ...

icon picture PDF Filetype PDF | Posted on 01 Feb 2023 | 2 years ago
Partial capture of text on file.
                                                       TUTORIAL                                          3 
             Objectives                                Welcome Application
             In this tutorial, you will learn to:
             ■ Set the text in the Form’s title 
               bar.                                   Introduction to Visual Programming
             ■ Change the Form’s 
               background color.
             ■ Place a Label control on the 
               Form.
             ■ Display text in a Label 
               control.
             ■ Place a PictureBox control 
               on the Form.
             ■ Display an image in a                  oday, users prefer software with interactive graphical user interfaces (GUIs)
               PictureBox control.                Tthat respond to actions such as Button clicks, data input and much more. As
             ■ Execute an application.                a result, the vast majority of Windows applications, such as Microsoft Word
                                                  and Internet Explorer, are GUI based. With Visual Basic, you can create Win-
                                                  dows applications that input and output information in a variety of ways, which
             Outline                              you learn throughout the book.
             3.1  Test-Driving the Welcome            In this tutorial, you use visual programming to complete the Welcome appli-
                  Application                     cation you began creating in Tutorial 2. You’ll build the application’s GUI by
             3.2  Constructing the Welcome        placing two controls—a Label and a PictureBox—on the Form. You’ll use the
                  Application                     Label control to display text and the PictureBox control to display an image.
             3.3  Objects Used in the             You’ll customize the appearance of the Form, Label and PictureBox objects by
                  Welcome Application             setting values in the Properties window. You’ll set many property values, includ-
             3.4  Wrap-Up                         ing the Form’s background color, the PictureBox’s image and the Label’s text.
                                                  You also learn how to execute your application in the Visual Basic 2008 IDE.
                                                  3.1 Test-Driving the Welcome Application
                                                  The last tutorial introduced you to the Visual Basic 2008 IDE. In this tutorial,
                                                  you’ll use Visual Basic to build the Welcome application mentioned in
                                                  Tutorial 2. This application must meet the following requirements:
                                                      Application Requirements
                                                        Recall that a software company (Deitel & Associates) has asked you to
                                                        develop a simple Welcome application that includes the greeting “Welcome
                                                        to Visual Basic 2008!” and a picture of the company’s bug mascot. Now that
                                                        you are familiar with the Visual Basic IDE, your task is to develop this applica-
                                                        tion to satisfy the company’s request.
                                                      You begin by test-driving the completed application. Then you’ll learn the
                                                  additional Visual Basic technologies that you’ll need to create your own version
                                                  of this application.
                                              simplyvb2008_03.fm January 28, 2008 5:12 pm                                   39
                                         © 2008 by Deitel & Associates, Inc. All Rights Reserved.
          40      Introduction to Visual Programming                                                               Tutorial 3
          Test-Driving the Welcome            1.  Opening the completed application. Start Visual Basic and select File >
                           Application            Open Project... (Fig. 3.1) to display the Open  Project dialog (Fig. 3.2).
                                                  Select the C:\Examples\Tutorial03\CompletedApplication\Welcome
                                                  directory. Select the Welcome solution file (Welcome.sln) and click the
                                                  Open Button.
                        Open Project… command
                      (selected) opens an existing
                                        project
                                                  Figure 3.1  Opening an existing project with the File menu’s Open Project... 
                                                  command.
                             Open Project dialog
                             Welcome solution file
                                                  Figure 3.2  Open Project dialog displaying the contents of the Welcome 
                                                  solution.
                                              2.  Opening the Form in design view. Double click Welcome.vb in the Solution
                                                  Explorer to open the Welcome application’s Form in design view (Fig. 3.3).
                                                  Figure 3.3  Welcome application’s Form in design view.
                                                 simplyvb2008_03.fm January 28, 2008 5:12 pm
                                            © 2008 by Deitel & Associates, Inc. All Rights Reserved.
             Tutorial 3                                                                          Welcome Application         41
                                       (cont.)   3.  Running the Welcome application. Select Debug  >  Start Debugging
                                                     (Fig. 3.4). The Start Debugging command runs the application. The Wel-
                                                     come Form shown in Fig. 3.5 appears.
                         Start Debugging command
                      (selected) runs the application
                                                     Figure 3.4  Running the Welcome application using the Debug menu’s Start 
                                                     Debugging command.
                                                                                                                         Close 
                                                                                                                         box
                                                     Figure 3.5  Welcome application running.
                                                 4.  Closing the application. Close the running application by clicking its close
                                                     box (     ).
                                                 5.  Closing the project. Close the project by selecting File > Close Project.
                                               3.2 Constructing the Welcome Application
                                               In this section, you perform the steps necessary to develop the Welcome applica-
                                               tion. The application consists of a single Form that uses a Label control and a Pic-
                                               tureBox control. A Label control displays text that the user cannot change. A
                                               PictureBox control displays an image that the user cannot change. You will not
                                               write a single line of code to create this application. Instead, you’ll use the tech-
                                               nique called visual programming, in which Visual Basic processes your actions
                                               (such as clicking, dragging and dropping controls) and writes the program for you!
                                               The following box shows you how to begin constructing the Welcome application,
                                               using the solution you created in Tutorial 2 as a starting point.
                                                 simplyvb2008_03.fm January 28, 2008 5:12 pm
                                            © 2008 by Deitel & Associates, Inc. All Rights Reserved.
            42        Introduction to Visual Programming                                                                                  Tutorial 3
            Changing the Form’s File                   1.   Opening the Welcome application’s project. Double click the
              Name and Title Bar Text                       C:\SimplyVB2008\Welcome\Welcome.sln file that you created in
                                                            Tutorial 2 to open your application. Double click Form1.vb in the Solution
                                                            Explorer window to display the blank Form. Figure 3.6 shows the Welcome
                                                            application open in the IDE.
                                            IDE title bar
                                                                                                                                           Solution Explorer 
                                                Toolbar                                                                                    window
                                          Form title bar                                                                                   Project name
                                                                                                                                           Form file name
                                            Blank Form
                                                            Figure 3.6     Blank Form.
                                                       2.   Changing the Form’s file name. When a Windows application is created,
                                                            Visual Basic names the Form file Form1.vb. Select Form1.vb in the Solution
                                                            Explorer window (Fig. 3.6) to display the file’s properties in the Properties
                     Good Programming                       window (the window on the left in Fig. 3.7). If either window is not visible,
                     Practice                               you can select View > Properties Window or View > Solution Explorer to
                                                            display the appropriate window. Double click the field to the right of the
             Change your application’s Form file            File  Name property’s box to select the current file name, and type
             name (Form1.vb) to a name that                 Welcome.vb (Fig.3.7). Press the Enter key to update the Form’s file name.
             describes the application’s purpose.           Note that the file name changes in the Solution Explorer window (the win-
                                                            dow on the right in Fig. 3.7) and in the Properties window.
                                                File properties
                                                                                                New file name
                                     Selected property                                     New property 
                                                                                           value
                            Selected property description
                     GUI Design Tip                         Figure 3.7     Changing the Form’s file name. 
             Choose short, descriptive Form titles.    3.   Setting the text in the Form’s title bar. The title bar is the top portion of the
             Capitalize words that are not arti-            window that contains the window’s title. To change the text in the Form’s title
             cles, prepositions or conjunctions.            bar from Form1 to Welcome, use the Properties window (Fig. 3.8). Click
             Do not use punctuation.
                                                            the gray area in the 
                                                                                    Form. As in Fig. 3.7, double click the field to the right of
                                                            the Text property in the Properties window to select the current text, and
                                                            type 
                                                                  Welcome. Press the Enter key to update the Form’s title bar (Fig. 3.9).
                                     Selected property                                         Property value
                         Selected property description
                                                            Figure 3.8     Setting the Form’s Text property.
                                                          simplyvb2008_03.fm January 28, 2008 5:12 pm
                                                     © 2008 by Deitel & Associates, Inc. All Rights Reserved.
The words contained in this file might help you see if this file matches what you are looking for:

...Tutorial objectives welcome application in this you will learn to set the text form s title bar introduction visual programming change background color place a label control on display picturebox an image oday users prefer software with interactive graphical user interfaces guis tthat respond actions such as button clicks data input and much more execute result vast majority of windows applications microsoft word internet explorer are gui based basic can create win dows that output information variety ways which outline throughout book test driving use complete appli cation began creating ll build by constructing placing two controls objects used customize appearance setting values properties window many property includ wrap up ing also how your ide last introduced mentioned must meet following requirements recall company deitel associates has asked develop simple includes greeting picture bug mascot now familiar task is applica tion satisfy request begin completed then additional tech...

no reviews yet
Please Login to review.