Learn the most popular programming language of the most popular Operating System: Windows

Ad

Writing Visual Basic Instructions-2

Exercise 2.6  Changing the Font Size Property

In this and the next two exercises, you change the properties of the form used in Exercise 2.5.

  1. Choose File, Open Project, if necessary, and select View, Project Explorer, or click the Project Explorer icon to open the Project window.  Click View Form.
  2. Click the form to give it the focus, and press F4 to open the Properties dialog box.
  3. Click font and change the font size to 18 points (or to another size if the size is not available on your system).
  4. Run the program.  Click to display the first sentence.  Press a key to display the second sentence.
  5. Exit to continue with the next exercise.

Exercise 2.7  Changing the Font Style Properties

In this exercise, use the form from Exercise 2.5 once again.

  1. Open the Properties dialog box and open the Font dialog box by double clicking the Font property.  Change the Font to Bookman Old Style (or another font if your system does not have this font installed).
  2. Change the style to bold and italic.
  3. Run the revised program.  Click to display the first sentence (it should be in bold and italic).  Press a key to display the second sentence.
  4. Exit and save your project at this time.  The next exercise asks you to begin a new project.

Exercise 2.8  Adding a Message to a Form and Changing Property Settings

In this exercise, you write a new procedure and change properties.

  1. Open a new project.
  2. Add the following Form_Click() Visual Basic procedure to the form:
    Private Sub Form_Click()
    'This procedure will display a Happy Birthday message
    Print "                 HAPPY"
    Print "                 BIRTHDAY"
    End Sub
    
  3. Change the following form properties:
    PropertySetting
    Backcolor Palette= &H00FF00FF& (light purple)
    BorderStyle= 1 'Fixed Single
    Caption= Today is the day
    Font Style= Italic
    Font= Arial
    Font Size= 24
    ForeColor Palette= &H00FF0000& (blue)
    WindowState= 2 'Maximized
  4. Run your program.
  5. Exit and save your program. Give the form a unique name, such as BDAY.FRM. Give the project a similar name, such as BDAY.VBP.
Share:

Popular Posts

Search This Blog

Powered by Blogger.

Featured Post

Coded Statements and Methods

In the preceding procedure , you wrote several coded instructions, which introduced two different programming statements and a method: the D...

Recent Posts