To get the default printer name in C# and VB.NET you can use the following snippet.
Samples
Sample C#
1 2 3 4 5 |
public string GetDefaultPrinter() { PrinterSettings settings = new PrinterSettings(); return settings.PrinterName; } |
Sample VB.NET
1 2 3 4 |
Public Function GetDefaultPrinter() As String Dim settings as PrinterSettings = New PrinterSettings() Return settings.PrinterName End Function |
If you have any questions or suggestions feel free to rate this snippet, post a comment or Contact Us via Email.
Related links: