VB6 Printing a long form only prints the first page

Posted on 2006-04-17
Last Modified: 2013-12-25
I have a form which allows the user to add items in a list, thus extending the length of the form. The form prints ok when it fits on the printer page, but when it goes off the first page the printer just doesn't bother with the rest of the form.
I have tried changing the frompage and topage of the Common Dialog control but it still won't print.
I have been using the Form1.PrintForm method. Is there a better way, or something I am missing?
Question by:andy_maskell
    LVL 65

    Accepted Solution

    (Potentially overly obvious comment)  
    If your intent to print out what appears to the user in a form, then that would best be handled in a report, which is optimized for printing on paper, as opposed to a form which is optimized to be a user interface.
    LVL 4

    Author Comment

    Thanks for the quick response.
    The form I want to print out is a stand alone VB application.
    There is no report generation done through a database.
    LVL 4

    Expert Comment

    Much like jimhorn said, unless there is a need to print the user interface, i.e., if your real need is to print the information contained on the form or in the list box, then I would use the printer object and make a report.  this can be done from the application using the information on the screen; it does not need to be a "database report."
    LVL 8

    Expert Comment

    I think what Jimhorn is trying to tell you, is if you want to print the information, do that.
    Don't print the form, it just takes extra space and does the user no good on paper.  In
    other words, copy the data to something which stores text, and print the text.
    LVL 4

    Author Comment

    So I guess I'm going about it the wrong way.
    Could anyone please tell me the best way to print the form info to a report, or point me towards a tutorial.
    LVL 4

    Assisted Solution

    use the printer.print method to print to your default printer.
    position on the paper by using the printer.CurrentX and printer.CurrentY properties
    write a subroutine for the header (title, page number, column titles, etc) then call it before you print the actual lines of the report and when you are going to go off the end of the page (about 14000 for portrait, 9500 for landscape)
    use printer.newpage to start a new page (but not the first page)
    user printer.enddoc when done


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Suggested Solutions

    Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
    I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now