Solved

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

Posted on 2004-10-14
3
206 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
[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
  • 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

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

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

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

623 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