Microsoft Visual Basic 2010 Step by Step eBook

(Tina Meador) #1

Chapter 17 Working with Printers 423


Now you’ll run the program to see how a text box object prints.

Run the Print Text program

Tip The complete Print Text program is located in the C:\Vb10sbs\Chap17\Print Text folder.


  1. Click the Start Debugging button on the toolbar.


Your program runs in the IDE.


  1. Verify that your printer is on.

  2. Type some sample text in the text box. If you type multiple lines, be sure to include
    a carriage return at the end of each line.
    Wrapping isn’t supported in this demonstration program—very long lines will
    potentially extend past the right margin. (Again, we’ll solve this problem soon .) Your
    form looks something like this:

  3. Click the Print Text button.


The program displays a printing dialog box and prints the contents of your text box.


  1. Modify the text box, and try additional printouts, if you like.

  2. When you’re finished, click the Close button on the form to stop the program.


Now you know how to print both text and graphics from a program.
Free download pdf