Printing Question


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: Printing Question

  1. #1
    Join Date
    Nov 2004
    Location
    UK
    Posts
    185

    Printing Question

    Hi All,

    In my program i am monitoring a folder, once somthing happens in this folder it does some processing on the data, and if there are any error it produces an error file: errorLog.txt

    What i want to know is: once it has created this errorLog how can i print it automatically, without having to go to file->Print ........ect
    Thankyou

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Nov 2004
    Location
    UK
    Posts
    185
    I have got this code which prints the document,

    Dim p As New System.Diagnostics.ProcessStartInfo
    p.Verb = "print"
    p.WindowStyle = ProcessWindowStyle.Hidden
    p.FileName = "D:\DB.log"
    p.UseShellExecute = True
    System.Diagnostics.Process.Start(p)

    I wanted to know how i can choose which printer to print to rather than using the default one?
    Thankyou

  4. #4
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    I don't know of any way to print to a printer other than the default using Process.Start. You'll have to use .NET's printer classes if you need more control: http://www.startvbdotnet.com/controls/printdialog.aspx
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  5. #5
    Join Date
    Mar 2005
    Posts
    71
    You may automate MS Word to print the file on background, but it is rather complicate.

    The simplest way is to set the default printer to the one you want before print. This can be done on the command line by
    Code:
    RUNDLL32 PRINTUI.DLL,PrintUIEntry /y /n "printer name"
    So, just use another 'Process.Start' to run the above command before print.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center