Solved

Printing the contents of a textbox ( sending the text to a printer0

Posted on 2004-10-14
3
201 Views
Last Modified: 2010-04-23
I have a form where after somr caculation are done the information is added to a textBox.  I want to place a button
on this form and when you click it. and it sends the text to the printer. How about doing the same with a listbox.

The text in the textbox is  like:

(100) ...One Hundred
(1,010)... One thousand Ten
(1,000,954)...One Million Nine Hundred Fifty Four
and so on

program converts numbers to text
0
Comment
Question by:ucla11
  • 2
3 Comments
 
LVL 4

Expert Comment

by:eozz_2000
ID: 12313205
You can use a printDocument to print the things you want in the printPage event of the object with the e.Graphics.DrawString method.
0
 

Author Comment

by:ucla11
ID: 12315341
eozz_2000 how would I use this code to print a Richtextbox?
0
 
LVL 4

Accepted Solution

by:
eozz_2000 earned 250 total points
ID: 12315805
   Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
        Dim Lines() As String = Me.RichTextBox1.Lines
        Dim strLine As String
        Dim y As Integer = e.PageBounds.Top
        For Each strLine In Lines
            e.Graphics.DrawString(strLine, New Font("Arial", 10, FontStyle.Regular), Brushes.Black, e.PageBounds.Left, y)
            y += 10
        Next
    End Sub
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Gridview selected row 9 44
Call windows 10 virtual keyboard from windows forms app 2 34
start a process from a service 3 21
Store results in vb.net 3 20
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

786 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