PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
VS 2010 Printing an Text File using PrintDialog-VBForums
Results 1 to 3 of 3

Thread: Printing an Text File using PrintDialog

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,133

    Printing an Text File using PrintDialog

    I have created an text file and saved it as "FileName.prn"
    Actually the file contains the data for barcode printer

    I wish to show the PrintDialog so that the user can select the Barcode Printer to print that file.

    I have tried the following code.

    vb Code:
    1. Dim psi As New ProcessStartInfo
    2.         psi.FileName = "Barcode.prn"
    3.         psi.Arguments = "notepad.exe"
    4.         psi.Verb = "print"
    5.         psi.WindowStyle = ProcessWindowStyle.Hidden
    6.         Process.Start(psi)


    I am facing two issues
    1st issue) I get the error as "No application is associated with the specified file for this operation"

    for testing purpose i changed the extension to .txt
    2nd issue) The file is directly been printed on the default printer. I need to show the PrintDialog


    Plz Help

    Regars

  2. #2
    Hyperactive Member
    Join Date
    Jun 2018
    Posts
    432

    Re: Printing an Text File using PrintDialog

    I dont know how to call the print dialog from process with notepad. However you could do that with vb.net code (instead of calling notepad) and use then vb print dialog to select the printer etc.

    What are you printing a bar code graphic ie the bar lines? Can you even print that with notepad?

    How do you make your file you want to print? What is that a text file?

    Anyhow, do you want to try it with vb.net? If so how do you generate the bar code graphics now? Have you looked for other vb.net code examples?

    Here is the print dialog docs.

  3. #3
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    102,961

    Re: Printing an Text File using PrintDialog

    You are setting the FileName and Arguments properties of your ProcessStartInfo the wrong way around. FileName can either be the name of a file that can be executed directly or else the name of a file whose type is registered as having a default application to open it. A ".prn" file is neither of those. Notepad is the executable that you want to run and the name of your PRN file is the commandline argument you want to pass to it.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width