[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

C# Richtextbox Print

Posted on 2011-10-18
4
Medium Priority
?
949 Views
Last Modified: 2012-05-12
Hi. I have to do a change in some old C# code.. it´s a big program so I can´t just redo the whole program.

Today they have LPT-port printers...  Step 1 is to change this to thernet new printers..
But my first task is this.

The program collect some data into a Richtextbox. Then it writes this out to a printer..
.I can´t understand that it should be this hard to do a print from a Richtext box..
I have google for a big time now but can´t figure this out..

Can someone give me som tips...
Can I do something like this

richtextbox.print() ore something...
0
Comment
Question by:kavvis
  • 2
  • 2
4 Comments
 
LVL 22

Accepted Solution

by:
Ivo Stoykov earned 1000 total points
ID: 36991018
Look here

HTH

Ivo Stoykov
0
 

Author Comment

by:kavvis
ID: 36992119
hi.
thank you for your replay...

I´m pretty new att C# so I got some problems to include this...

On a button click I do this..

 PrinterSettings settings = new PrinterSettings();
         Console.WriteLine(settings.PrinterName);
     prtxt = RptText.Text;

//and then I try to include this part..

        // Print RichTextBox content
        private void PrintCommand()
        {
            PrintDialog pd = new PrintDialog();
            if ((pd.ShowDialog() == true))
            {
                //use either one of the below      
                pd.PrintVisual(richTB as Visual, "printing as visual");
                pd.PrintDocument((((IDocumentPaginatorSource)richTB.Document).DocumentPaginator), "printing as paginator");
            }
        }


But I cant figure this out :(
0
 
LVL 22

Assisted Solution

by:Ivo Stoykov
Ivo Stoykov earned 1000 total points
ID: 36993146
what's the problem?
0
 

Author Comment

by:kavvis
ID: 37242236
I will get back to you with new info asoon as I can...
0

Featured Post

Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

Question has a verified solution.

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

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

872 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