From: Nobody on 19 Dec 2009 13:29 "Martin" <ironwoodcanyon(a)gmail.com> wrote in message news:9sppi5dehcm6k3bjpcbs8l3lt0nvg6s2qc(a)4ax.com... > I understand that this is not a very good way to print stuff. What is > a recommended way to print a report from VB? Besides what others suggested, one way for simple reports is to use the Printer object, which supports Print and graphics methods. Print method is not listed as part of Printer/PictureBox in the help, but you can use it with them. Example: Option Explicit Private Sub Form_Load() Debug.Print Printer.ScaleMode Debug.Print Printer.ScaleWidth Debug.Print Printer.ScaleHeight Debug.Print Printer.ScaleLeft Debug.Print Printer.ScaleTop Debug.Print Printer.Width Debug.Print Printer.Height Printer.DrawWidth = 10 Printer.FontSize = 16 Printer.Print "ABC" ' Position to the center of the page Printer.CurrentX = (Printer.ScaleWidth - Printer.TextWidth("+")) / 2 Printer.CurrentY = (Printer.ScaleHeight - Printer.TextHeight("+")) / 2 Printer.Print "+" Printer.Circle (Printer.ScaleWidth / 2, Printer.ScaleHeight / 2), 1440 Printer.EndDoc End Sub But as Ralph suggested, your needs will quickly grow, and reinventing the wheel takes more time. VB has a report designer, but it's limited. VB also comes with Crystal Reports, which is more sophisticated, but it's not installed as part of VB5/6. You have to install separately. See this article: How to install Crystal Reports for use in Visual Basic 6.0 http://support.microsoft.com/kb/193336 |