Solved

How to print in VB5 ?

Posted on 1998-10-14
6
287 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

863 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

28 Experts available now in Live!

Get 1:1 Help Now