Solved

Printing text

Posted on 1998-10-18
6
173 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
ID: 1440454
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
ID: 1440455
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
ID: 1440456
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
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.

 
LVL 5

Expert Comment

by:AnswerTheMan
ID: 1440457
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
ID: 1440458
I was trying to do it old fashion way but thanks
0
 
LVL 3

Accepted Solution

by:
kfrick earned 150 total points
ID: 1440459
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

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

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…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
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…

914 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

19 Experts available now in Live!

Get 1:1 Help Now