How to Get Printer Information Using VB6

Written by jim campbell
  • Share
  • Tweet
  • Share
  • Email

Microsoft Visual Basic 6 (VB6) provides you with a Printer class that lets you set up and retrieve printer information. Use this class to identify the printer before sending the print job to the device. Several properties are available in the Printer class, so you must determine what property you want to view from the code and return it to a string variable.

Skill level:
Moderate

Other People Are Reading

Instructions

  1. 1

    Right-click the VB6 solution file on your desktop. Select "Open With," then double-click "Visual Basic" to open the software.

  2. 2

    Right-click the form you want to use to retrieve the printer properties and select "View Code." The code file loads in the editor.

  3. 3

    Create a class variable for the printer. Type the following code to start the printer process:

    Dim printer As Printer()

  4. 4

    Get the name of the printer. Unless you specify a different printer, the "DeviceName" property retrieves the name of the default printer on the desktop. Type the following code to retrieve the device name:

    Dim printername As String

    printername = printer.DeviceName

  5. 5

    Retrieve the number of pages currently printing. The following code retrieves the information:

    Dim pages As String

    pages = printer.Pages

  6. 6

    Click the "Save" button and click "Run" to run the code in the debugger. You can view your code changes and test for any syntax errors in the debugger.

Don't Miss

Filter:
  • All types
  • Articles
  • Slideshows
  • Videos
Sort:
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the eHow.co.uk site, you consent to the use of cookies. For more information, please see our Cookie policy.