Solved

How to print in VB5 ?

Posted on 1998-10-14
6
283 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
  • 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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

757 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now