Solved

Printing text

Posted on 1998-10-18
6
172 Views
Last Modified: 2010-04-30
I wanted to know how I could print text from a textbox like Wordpad prints text. For example if I had a textbox where I typed an essay out. How would I print that textbox so that the essay looks like it was printed by Wordpad or Wordperfect.
0
Comment
Question by:heydes
6 Comments
 
LVL 4

Expert Comment

by:mcix
Comment Utility
Have you checked out the Rich Text Box Control?

You can do some fairly complicated formatting with it...
0
 
LVL 12

Expert Comment

by:mark2150
Comment Utility
I have code module avail for RichTextBox that allows changing fonts, alignment, colors, etc and prints accordingly. Contact me direct:

Mark_Lambert@ntsc.navy.mil

if you want program source.

M

0
 

Author Comment

by:heydes
Comment Utility
I can't use RichText because im working in standard and its not registered. I get a license error when i try to add it onto my form. If you can tell me how i could load it onto my form without buying vb5 enterprise. I'd be happy to give you the points just for that ;) thanks
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 5

Expert Comment

by:AnswerTheMan
Comment Utility
NowDays, i don't think that programers have to really program print jobs. for that we have a some powerfull tools we can use.
if i were u - i would make a little database with a MEMO field,
and use one of them tools to make a report based on that database-field.
0
 

Author Comment

by:heydes
Comment Utility
I was trying to do it old fashion way but thanks
0
 
LVL 3

Accepted Solution

by:
kfrick earned 150 total points
Comment Utility
Here's the old fashioned way.....

Make a form with a multi-line text box and a command button. Put this code behind the form:

Private Sub Command1_Click()
Dim szTemp As String
Dim szText As String

    szText = Text1.Text
    While Len(szText) > 0
        szTemp = Left$(szText, InStr(szText, Chr$(13) + Chr$(10)) - 1)
        szText = Right$(szText, Len(szText) - (Len(szTemp) + 2))
        Printer.Print szTemp
    Wend
    Printer.EndDoc
End Sub

You can play around with the Printer object for Fonts. You can add a few spaces to the beginning of each line for a fixed margin.
Have fun!

-kf

0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…

771 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

7 Experts available now in Live!

Get 1:1 Help Now