Thanks for the reply Samuel, but after more searching, I finally found
someone else's code I used as an example.
Private Sub mnuMailLabel_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles mnuMailLabel.Click
Dim doc As PrintDocument = New PrintDocument
Dim printer As PrintDialog = New PrintDialog
printer.Document = doc
printer.PrinterSettings.PrinterName = My.Settings.MPrinter
printer.Document.DefaultPageSettings.PaperSize = New
Printing.PaperSize(Printing.PaperKind.Custom, 350, 100)
AddHandler doc.PrintPage, AddressOf PrintPageHandler
doc.Print()
End Sub
Private Sub PrintPageHandler(ByVal sender As Object, ByVal e As
PrintPageEventArgs)
Dim canvas As Graphics = e.Graphics
Dim _font As Font = New Font("Tahoma", 10)
Dim _brush = Brushes.Black
Dim PrintString As String
PrintString = txtFName.Text & " "
If Trim(txtMI.Text) <> "" Then
PrintString = PrintString & VB.Left(txtMI.Text, 1) & " "
End If
PrintString = PrintString & txtLName.Text & vbCrLf &
txtAddress.Text & vbCrLf & txtCity.Text & ", " & txtState.Text & " " &
txtZip.Text
canvas.DrawString(PrintString, _font, _brush, 0, 0)
End Sub
The line:
printer.Document.DefaultPageSettings.PaperSize = New
Printing.PaperSize(Printing.PaperKind.Custom, 350, 100)
was what I couldn't quite figure out how to do. This code works fine
in my program.