Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

print flat files...??

Posted on 1998-10-12
3
Medium Priority
?
147 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 150 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
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…
Suggested Courses
Course of the Month11 days, 10 hours left to enroll

916 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