Solved

How to print in VB5 ?

Posted on 1998-10-14
6
303 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
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MsgBox 2 64
Add and format columns in vb6 7 82
converting visio 2010 to powerpoint 2010  - formatting issues 5 120
Modify Text File with Excel Macro 13 46
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

737 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