How do you perform a Printer setup procedure and a Print?

H

Harry J. Smith

My last post had a wrong From field. Should have been Harry J. Smith, not
news.west.earthlink.net, So I will repeat my lead-in.

I have been studying the book "Microsoft Visual C# .NET Step by Step" and am
now trying to develop a program in C#. I have some questions partially
because I do not have the MSDN Library with the help files.

How do you perform a Printer setup procedure and a Print?

In Visual basic my code looks like this:

Private Sub menPrintSetup_Click()
CommonDialog1.ShowPrinter
End Sub

Private Sub menPrint_Click() 'Read Help file from disk and print it
Dim Lines As Integer
Dim Indent As String
Dim St As String

Indent = " " '20 spaces
On Error GoTo TrapOpen
Open HelpFile For Input As #5
On Error GoTo 0
Lines = 0
Printer.FontName = "Tahoma"
Printer.FontBold = False
Printer.FontSize = 12
Printer.Print vbCrLf & vbCrLf
Do While Not EOF(5) 'Loop until end of file.
Line Input #5, St
Printer.Print Indent & St 'Print a line of Help
Lines = Lines + 1
If Lines Mod 48 = 0 Then
Printer.NewPage 'Send new page
Printer.Print vbCrLf & vbCrLf
End If
Loop
Printer.EndDoc 'Printout is done.
Close #5
Exit Sub
TrapOpen:
If Err.Number = 53 Then 'File not found
PLn "File not found: " & HelpFile
Exit Sub
End If
On Error GoTo 0: Resume
End Sub 'menPrint_Click

-Harry
 

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