CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 2 of 2

Thread: Print a text file from VB Program without using input function

  1. #1
    Join Date
    Jul 2002
    Chandigarh,(U.T.), India

    Lightbulb Print a text file from VB Program without using input function

    Hello Guru,
    My name is Varinder Hatta and i am MCA from P.U. , Chandigarh working as a software programmer. I have a Problem in VB6.0 in th area of printing. There is a Printer object for printhing, it allows direct printing to the printer like

    Printer.print #intfilenum,"Sone string datra here"

    But it deoes not a print a text file directly.
    Input function is not valid for fetching data from large text file. if i use intput function, vb generate error i.e. err. no. 28 stack out of space.

    I write the data in a text file and close that file, now how i print that file. Please Help Me.

    I have also used the C++ program to open file and try print to the printer, in this case my printer is USB port,book have shown only COM1,LPT1,PLT2 port, this C++ program run but donot print any file data. It show no error also. In case of USB port what parameter i passed. Book Author name is Robert Laforee for C++. Help me in all the above two cases.

    (Varinder Hatta)

  2. #2
    Join Date
    May 1999
    Farnborough, Hants, England
    Are you saying that even if you say

    Line Input #intFilenum, strText
    Printer.Print strText

    repeatedly until the end of the input file is reached, this causes a stack overflow? Trying to read the whole file at once into memory and then printing could well do that, but not one line at a time... don't forget to call Printer.NewPage after an appropriate number of lines have been written.

    You can also explore the Shell function, which should allow you to print the file as if you were doing it from the command line (DOS prompt) (i.e., something like "copy somefile.txt LPT1:" - but that's not exactly right, I can't seem to get it to work from the command line right now {:v( ).

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)