Pro VB 6For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
VB does not care what type or printer you have, it may be a Dot Matrix or a Colour Laser, You can just uses the Printer object and VB sends it to the Windows print spooler for Windows to handle and print.
Unfortunatelly the Printer object does not throw errors...
It is possible that the default font does not exist in your printer. Try to enumerate the Fonts property to find a valid font.
I assume that that printer is set as your default printer :) to be sure of it, just look the DeviceName property. You can do all of this using the immediate window (Ctrl+G) even without running your app, just type
?Printer.DeviceName
or
?Printer.Fonts(0)
etc.etc.
FYI: If I try to print the file from notepad to the dmp, it prints garbage also. So I agree that it either a font issue, or maybe even a print driver issue.
The printer is a Okidata ML 520 on an XP Pro workstation. XP automatically found the printer and installed the driver.
it sounds like a driver problem to me.
try the web site of the printer manifacture, and see if they have a driver to download. it is possible that XP loaded a 'closest' driver for that printer, but not that close. your idea to print from notepad is excellent. if it dooes not work there there is no point on writing code.
Marco