Results 1 to 9 of 9

Thread: How to get the name of default printer?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2003
    Posts
    784

    Question How to get the name of default printer?

    How to get the name of default printer? .. please help

    thanks

    Winanjaya

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Like this :

    VB Code:
    1. Dim P_Name As New PrintDocument
    2. MessageBox.Show(P_Name.PrinterSettings.PrinterName())

  3. #3
    Addicted Member WALDO's Avatar
    Join Date
    Aug 2002
    Location
    Swing of Prussia, PA
    Posts
    244

    Keeps you from having to create a PrintDocument

    VB Code:
    1. Dim Settings As New System.Drawing.Printing.PrinterSettings()
    2. Dim strPrinter As String = Settings.PrinterName

  4. #4
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Re: Keeps you from having to create a PrintDocument
    Ok , if you don't want to create any obj , then use the static class PrinterSettings .

    VB Code:
    1. Printing.PrinterSettings.InstalledPrinters.Item(0)

  5. #5
    Addicted Member WALDO's Avatar
    Join Date
    Aug 2002
    Location
    Swing of Prussia, PA
    Posts
    244
    will that return you the default printer, or just the first of your installed printers?

  6. #6
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    I've just tested it here and it returns the default printer name even if it's the last one installed .

  7. #7
    Addicted Member WALDO's Avatar
    Join Date
    Aug 2002
    Location
    Swing of Prussia, PA
    Posts
    244
    OK, cool. Even fewer lines of code.

  8. #8
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

  9. #9
    Addicted Member WALDO's Avatar
    Join Date
    Aug 2002
    Location
    Swing of Prussia, PA
    Posts
    244
    You really are a pirate, aren't you ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width