Solved

print flat files...??

Posted on 1998-10-12
3
133 Views
Last Modified: 2010-04-30
Hi ,
  I know Vb5 but not printing very well... I need your help!
How do u print flat files to the printer...
Do I have to read each line from the file and then
code--> MyPrinter.Print (thestr)
and then loop until I have read the whole file??
Is there a better way /or a more professional way??
SOme code examples would be great!! Thanks!!!


0
Comment
Question by:Haho2
3 Comments
 
LVL 5

Expert Comment

by:scrapdog
ID: 1439560
You can't get any more professional/better than that...
0
 
LVL 14

Expert Comment

by:waty
ID: 1439561
If you use the PrintPreview OCX :
  http://www.geocities.com/ResearchTriangle/6311/prview50.zip

You can read an entire file, preview it, print it... in only one instruction.
0
 
LVL 12

Accepted Solution

by:
mark2150 earned 50 total points
ID: 1439562
Your code example is correct. You may need to implement a "word wrap" function. Why a language as sophisticated as VB doesn't have better printer support is beyond me. You have to track when you jump pages so you can know to generate page headings, etc.

The RichTextBox will print and wrap automatically (if you set the .RightMargin), but it won't print page headings, etc.

I have code for word wrap if you need. Is much too complex than such a low level operation should be, but is only way to make it generic and font insensitive. When you're using proportional fonts you just can't chop a line at, say col 65, and have it look good.

e-Mail me at mark_lambert@ntsc.navy.mil and I'll ship you the code for the wrap function.

M

0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
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…

746 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

10 Experts available now in Live!

Get 1:1 Help Now