Solved

print flat files...??

Posted on 1998-10-12
3
135 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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

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 need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…

772 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