Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2004-10-14
3
Medium Priority
?
209 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 1000 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

886 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