Printing

Well, the simplest way to print a part of your program is the command Form1.PrintForm, which will print exactly what Form1 looks like, to the printer.

Of course, that's fairly useless, so there's another way, namely, the LPrint command. LPrint will print any string directly to the printer, like this:

     LPrint "Statistical Information"
     LPrint
     LPrint "Name: " + name
     LPrint "Address: " + address
     LPrint "Age: " + Str$(age)

Every LPrint command goes to the next line after printing its line, so the above commands would result in output that would look something like this:

     Statistical Information

     Name: John C. Dvorak
     Address: 1500 Jones Branch Drive
     Age: 52

You can also control your output a little more, thanks to the Printer object, which includes three functions: Printer.NewPage, which tells the printer to advance to the next page, Printer.EndDoc, which tells the printer that this job is done, and Printer.KillDoc, which tells the printer to cancel this printing job.

You can also, while in the VB environment, click the drop-down menu File -> Print, which will print your project's properites and code.


The Intro to Visual Basic homepage is hosted by GeoCities