Ross Sheppard High School
Computer Programming 20
Student Learning Guide
The Show Font Program


  When you have finished this project, you will be able to:
use font properties
apply font properties to a TextBox
  1. Create a new folder called Show Font on your personal drive.

  2. The illustration below shows the visual implementation for the Show Font program.




    The Show Font Program

    The user can select a font from a menu and from checkboxes and the font will be displayed in txtTest TextBox.

  3. Start a new Standard.exe project in Visual Basic. Save this project as prjShowFontProgram and the form as frmShowFontProgram in the ShowFont Program folder.

  4. Use the table below to create the Visual Implementation of the Show Font Program:

    Objects Table
    Object Property Setting
    Form Name frmShowFont
      Caption The ShowFont Program
      Icon Font02.ico
    Copy this icon from the Handout folder to your project folder
    TextBox Name txtTest
      MultiLine True
      ScrollBars Both
      Text Make it blank
    CheckBox Name chkBold
      Caption Bold
      Font Make it a bold font
    CheckBox Name chkItalic
      Caption Italic
      Font Make it an italic font
    CheckBox Name chkStrike
      Caption Strike
      Font Make it a strikeout font

    Note: for the purpose of enhancing the Visual Implementation of the ShowFont Program, you may change other properties such as StartUp Position, background color, etc.

  5. Use the table below to create the menu items for the ShowFont Program:


    Menu Table
    Caption Name Property
    &Fonts mnuFonts Menu Bar
    &Courier mnuCourier Sub-menu
    &MS Sans Serif mnuMSSansSerif Sub-menu
    &Size mnuSize Menu Bar
    1&0 Points mnu10Points Sub-menu
    1&2 Points mnu12Points Sub-menu

  6. Now that you have completed the Visual Implementation of the ShowFont Program, you can begin to create the code.

  7. Add the programmer information and Option Explicit code to your ShowFont Program.

  8. Create the code for the CommandButton btnExit.

  9. Save your project and run it - you should be able to create code for the Exit Button without a mistake at this point.

  10. Write the code for the btnBold_Click procedure as shown below:



  11. Write the code for each of the CommandButtons: btnItalic, btnStrike, and btn Underline.

  12. Save your project and run it.

  13. Type any text into the TextBox txtTest.

  14. Click on the CommandButtons and see if your program works. When you press the CommandButtons for bold, italic, underline, or strike through, the test you typed should change to that selection. If not, check your code very carefully.

  15. Next, create the code for the MenuItem mnu:



  16. In a similar manner, write the code for the other menu items: mnuMSSansSerif, mnu10Point, and mnu12Point.

  17. Save your project and run it. Does everything work?

  18. Click here to see the marking guide for this project.

  19. When you have finished, send an email to your teacher asking that this project be marked.


© 1998-2000 N.F. Mathew, EdD
File name: ShowFont.htm
Last updated on October 18, 2000