Solved

print flat files...??

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

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

Title # Comments Views Activity
using Access 8 59
Excel VBA, find a string in a column, update a cell 7 67
VBA: Select SQL query based on a config Sheet v2 11 38
using web browser with BING 40 111
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.
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…
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…

867 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

21 Experts available now in Live!

Get 1:1 Help Now