Solved

How to print in VB5 ?

Posted on 1998-10-14
6
308 Views
Last Modified: 2008-02-26
I have a serial printer EPSON TM-T88M. How can I print to the printer? Plese give me some sample code.
0
Comment
Question by:anik
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 

Expert Comment

by:Haho2
ID: 1440004
regardless of whatever printer u have, as long as Win95 detects and supports your driver/s , you can print to the printer.
It is very simple...  
 --> printer.print  string ( or bitmap)

such as printer.print "Hello"
or printer.print "bunny.gif"

aslo look at EndDoc, KillDoc...

but the drawback to printing text is that it prints one line of text each time..
meaning that if u want to print a document, you must read it line byline and print each line.
  If u want to let the user choose Printer properties, use Commondialog and then call the Showprinter dialog...

 
0
 

Author Comment

by:anik
ID: 1440005
OK I tried it but I don't want the user to select a printer. How can I specify the default printer ?

Also I tried
printer.print "c:\aaa.bmp"
It just print out the line say c:\aaa.bmp. Not picture !

0
 
LVL 2

Accepted Solution

by:
dabellei earned 10 total points
ID: 1440006
By default VB will use the default printer without any action from the user.

You can't send a command like printer.print "c:\aaa.bmp"  

printer.print will print the text inside the quote not the content of the file.

If you want to print a text file you'll have to open it before and then read it line by line and print it line by line using printer.print.

To print a .bmp file it's different as you would have to use API function (HDC...) to print a bitmap or any file containing graphic stuff in it.

Is your question is how to print graphic file or text file?

For a text file i can send you a program (code sample) on how to do it, but for graphic it's little more complicated and take more time for that (and point maybe...) if you want a text example just leave a comment (don't reject the answer) i'll send you one.
0
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 

Author Comment

by:anik
ID: 1440007
OK send me the file. Do you also have printing graphics example? I will increase point to 50 for graphics printing.
0
 
LVL 2

Expert Comment

by:dabellei
ID: 1440008
What's your email?

0
 

Author Comment

by:anik
ID: 1440009
akarapol@bigfoot.com
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question