Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
|
Pro VB 6 For 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
 
Old April 24th, 2004, 01:09 AM
Registered User
 
Join Date: Apr 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to print text file on DMP

how to print text file on Dot Matrix Printer using VB6.0 codes
Thanks & reg.

 
Old April 27th, 2004, 03:26 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 231
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

Regards
Owain Williams
 
Old April 28th, 2004, 01:13 AM
Registered User
 
Join Date: Apr 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks , but i have problem while printing of text file (it may be alian problem)
like
001 ddddd dfasdf
002 dddd dasfsda
003 ddd ddddd



 
Old May 10th, 2004, 11:42 AM
Registered User
 
Join Date: May 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am having the same problem. Have you found a solution?

Thanks

 
Old May 10th, 2004, 12:04 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

can you send us the code you are using?
Marco

Quote:
quote:Originally posted by dugbert
 I am having the same problem. Have you found a solution?

Thanks

 
Old May 10th, 2004, 12:09 PM
Registered User
 
Join Date: May 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Open App.Path & "\logs\Checkruns\" & xFile & ".prn" For Input As #2

Do Until EOF(2)
   Line Input #2, strTemp
   Printer.Print strTemp
Loop

Printer.EndDoc
Close #2

 
Old May 10th, 2004, 03:25 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

Marco
 
Old May 10th, 2004, 08:54 PM
Registered User
 
Join Date: May 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your help.

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.

 
Old May 11th, 2004, 12:02 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Print arbitrary text Joachim Hofmann SQL Language 0 November 14th, 2005 06:23 AM
Print and print preview file on the website withou appleLover General .NET 0 February 19th, 2005 02:24 AM
vb-printing on DMP kumar Beginning VB 6 1 September 30th, 2004 06:24 AM
how to print on DMP kumar Beginning VB 6 1 September 30th, 2004 06:22 AM
Print value of a variable to text file SubodhKumar SQL Language 2 December 10th, 2003 03:02 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.