Printing

L

Lou

How do I use the printdialog. If I call
PrintDialog1.ShowDialog

it gives me an error mesage to set th edocumt

I have a text box control with text that I want to print from a command
button?

-Lou
 
L

Lou

That example only shows how to print a file, I want to print the contents of
a textbox. w/o having to save it to a file.
 
L

Lou

also the code lin
Dim pd As TextFilePrintDocument = New TextFilePrintDocument(streamToPrint)

it errors out

TextFilePrintDocument is not defined?
 
S

Siva M

If you look at the source (URL:
http://samples.gotdotnet.com/quicks....src&file=CS\TextFilePrintDocument.cs &font=3),
the OnPrintPage method reads the file content line-by-line and prints to the
printer. Instead of reading the text from a file, replace it with your text.
That is,

ev.Graphics.DrawString ("My text line", printFont, Brushes.Black,
leftMargin, yPos, new StringFormat());
ev.HasMorePages = false;

prints "My text line" on the printer.

leftMargin & yPos calculations may be taken as is from the sample.

HTH.

That example only shows how to print a file, I want to print the contents of
a textbox. w/o having to save it to a file.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top