Login or Sign Up to become a member!
LessThanDot Sit Logo

LessThanDot

Community Wiki

Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.

LTD Social Sitings

Lessthandot twitter Lessthandot Linkedin Lessthandot friendfeed Lessthandot facebook Lessthandot rss

Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.

Navigation

Google Ads

VB.Net: Selecting a printer

From Wiki

Jump to: navigation, search

Sometimes it can be nice to select the printer you want to print on without letting the user choose the correct one.

  1. Public Shared Sub SelectPrinter(ByRef PrinterSettings As PrinterSettings, ByVal PrinterName As String)
  2.             For inttemp As Integer = 1 To System.Drawing.Printing.PrinterSettings.InstalledPrinters.Count
  3.                 If System.Drawing.Printing.PrinterSettings.InstalledPrinters.Item(inttemp - 1).ToString.ToUpper = PrinterName.ToUpper Then
  4.                     PrinterSettings.PrinterName = System.Drawing.Printing.PrinterSettings.InstalledPrinters.Item(inttemp - 1).ToString
  5.                 End If
  6.             Next
  7.         End Sub

the above function takes the name of the printer as a parameter and also the printersettings of the object you want to use for printing or printpreviewing.

379 Rating: 3.0/5 (2 votes cast)