Text File Printing
David Sharpe
New to VB programming? David Sharpe, one of our subscribers, was as well, when he ran into a problem. It's an easy problem, but sometimes the easiest problems cause the most trouble. Anyway, David sends this tip in hopes that his investigations will help others. If you have a better solution to this problem, why not share it with other VB developers. If we pick your tip, you'll get a free SearchVB denim shirt.
I am somewhat new to VB, but I have a good background in DOS Foxpro and some exposure to QuickBasic. A VB 6 program I'm writing was to create a document as a text file on the PC (to store for historical reasons) and then simply send it to the printer for a hard copy. I initially found it difficult to determine how to create the local text file, then really got lost when I attempted to find out how to get it printed.
I was a finally able to figure it out, and thought my findings might be helpful or informative in some way to others.
The basic creat
To continue reading for free, register below or login
To read more you must become a member of SearchWinDevelopment.com
');
// -->

ion of the local text file seems to follow older basic structures, although I could find no document in MSDN that helped. So here's how I did it.
The following would read all of the lines (txtLine) in the file
"TxtFileToRead" and write each line into "TxtFileToWrite"
To print a file requires use of two methods of the "Printer
Object". The follwing will read each line (txtTheLine) in a text file (txtTheFile), store it in the Printer Object and then causes the Printer Object to be actually be sent to the printer.
I hope that this will be of benefit to others.
Thanks, David. For your interest in SearchVB, we'll be sending you a denim shirt.
"I've been wrestling with PCs and databases since 640k of
ram was 'Dreamed for,' neither Dbase nor MSDos had revision
levels, and GW-Basic was IT!"
Dave Sharpe works in the Materials Management Department of BellSouth
Communication Systems in Roanoke,VA. His major functions involve
ad hoc reporting from the corporate Oracle databases using
MSAccess.