Printing word and pdf files in vb.net

I am trying to print a list of files including .docx and .pdf  

the problem that I having is that when I go to print to the printer the order is not as expected.  I want the order to print in the order of the enclosure list, which when I debug, the order is correct. Just not going to the print que correctly.  I do not want to install a 3rd party .dll

Please help!!!!

enclosureList = [1]"C:\..\..\wordfile.docx"
                            [2]"C:\..\..\pdfFile_1.pdf"
                            [3]"C:\..\..\pdfFile_2.pdf"
                             ...
                            [11]"C:\..\..\pdfFile_10.pdf"

For x As Integer = 0 To enclosureList.Count - 1
                Dim psInfo As New ProcessStartInfo

                With psInfo
                    .UseShellExecute = True
                    .Verb = "print"
                    .FileName = enclosureList(x)
                    .WindowStyle = ProcessWindowStyle.Hidden
                    Process.Start(psInfo)
                End With
            Next

Open in new window

taviafAsked:
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.

Éric MoreauSenior .Net ConsultantCommented:
Could it just be that some processes are faster than other?

I would add a Thread.Sleep(5000) after your Process.Start.
0

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
ChloesDadCommented:
If that doesn't work you could also use the hasExited property so that you wait forone to complete before you start the next

For x As Integer = 0 To enclosureList.Count - 1
                Dim psInfo As New ProcessStartInfo

                With psInfo
                    .UseShellExecute = True
                    .Verb = "print"
                    .FileName = enclosureList(x)
                    .WindowStyle = ProcessWindowStyle.Hidden
                    Process.Start(psInfo)

                    While Not Process.HasExited
                         Thread.sleep(100)
                    Wend

                End With
            Next

Open in new window

0
taviafAuthor Commented:
Thanks to you both...
0
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
.NET Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.