Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

print flat files...??

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
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…
Suggested Courses

715 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