Print to a printer other than the default one

im printing some pdf files and no matter what printer I select it always prints to the default one. This is the code...

If Me.PrintDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then

                Dim printername As String = Me.PrintDialog1.PrinterSettings.PrinterName
                For Each row As DataGridViewRow In dgv_Invoices.Rows

                    If row.Cells("Selected").Value = True Then

                        Dim filename As String = row.Cells("File").Value
                        Dim proc As New Process
                        Dim startInfo As New ProcessStartInfo(filename)

                        startInfo.FileName = filename
                        startInfo.Arguments = " " & Chr(34) & printername & Chr(34)
                        startInfo.WindowStyle = ProcessWindowStyle.Hidden
                        startInfo.Verb = "print"
                        proc.StartInfo = startInfo
                        row.Cells("Status").Value = "Printed"

                    End If

            End If

Any ideas on this??
Thanks experts!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Red-KingIT ManagerCommented:
I've used the Application.ActivePrinter property in the past to do this.
I'm not sure you can use it outside of MS Office vb scripts but you could give it a try.

In my script I have;
Sub PrintZebra1()

    ActivePrinter = "Zebra TLP2824"
    With Options
        .UpdateFieldsAtPrint = False
        .UpdateLinksAtPrint = False
        .DefaultTray = "Use printer settings"
        .PrintBackground = True
        .PrintProperties = False
        .PrintFieldCodes = False
        .PrintComments = False
        .PrintHiddenText = False
        .PrintXMLTag = False
        .PrintDrawingObjects = True
        .PrintDraft = False
        .PrintReverse = False
        .MapPaperSize = False
        .PrintOddPagesInAscendingOrder = False
        .PrintEvenPagesInAscendingOrder = False
        .PrintBackgrounds = False
    End With
    With ActiveDocument
        .PrintPostScriptOverText = False
        .PrintFormsData = False
    End With

    Application.PrintOut Filename:="", Range:=wdPrintCurrentPage, Item:= _
        wdPrintDocumentContent, Copies:=1, Pages:="", PageType:=wdPrintAllPages, _
        ManualDuplexPrint:=False, Collate:=True, Background:=True, PrintToFile:= _
        False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _

End Sub

Open in new window

You use the name displayed within the Printer Properties when setting the ActivePrinter property as far as I recall.
Here's the reference from the Office Dev Center


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Éric MoreauSenior .Net ConsultantCommented:
I wrote an article a while back to show how to change the default printer:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.