Click to See Complete Forum and Search --> : Printing in Visual Basic


Mike Harbison
March 22nd, 1999, 06:47 AM
I am having a difficult time trying to print out a invoice in Vb 5. All I am trying to do is create a simple invoice that I can print with my desired fields. I am basically duplicating the invoice from Excel. Is there any easy way of creating invoices in VB? I have used the line tools and the shape tools on the form and then used printform, but I can only create half the page. Since I can't view the entire form at design time. I have tried using crystal reports, but you can't pass just variables to a text box. Atleast I haven't figured out how. I have tried using currentx and current y, but this seems very cumbersome. How come VB gives you the tools to draw lines and boxes, but only limits you to half the size of the form? In Delphi you have a simple report design which as you create the invoice you can either preview it or print it on the fly. Vb has no print preview so I had to get a 3rd party OCX which works fine.

Can anyone tell me how I can use the line tools and the shape tools to create and build a simple report. Just tell me how I can draw a line on the bottom of a page and print it out.

Thank you for any help.

Roy
March 22nd, 1999, 11:00 PM
The best way to print is using the printer object command. If your form has text boxes, combo boxes, list boxes etc, you can print the contents of these by typing

Printer.Print object.text

where you substitute the name of your textbox or combobox (text1 or dbcombo1 etc)

If you do not care about gridlines you can space these out by typing

Tab(x);

where x is the distance from the left hand margin. If you use ; after the Tab command, you can place object contents on the same line. If you omit the ; then the next Tab statement will be printed on the next line.


Good luck


Roy