C# (C-Sharp) is a programming language developed by Microsoft that runs on the .NET Framework. And used to develop web application, desktop application, mobile application, games application and much more.

C# is a simple, modern, general-purpose, object-oriented programming language developed by Microsoft within its .NET initiative led by Anders Hejlsberg.

This tutorial is how to get list of printer name installed in your PC using C# Development.

Please follow the steps.

  • First Create a project to in VS (Visual Studio);

Click file and New then Project.

  • After that Please follow this steps.
    1. Click or select Visual C#
    2. At this point I choice Windows Form App (.NET Framework).
    3. Create project name “getListPrinterName
    4. Then Ok;
  • after the project begin.
    1. add DataGridView to the form to display the list of all Printer name install from you PC’s
    2. And Button function for Get Execution.
  • Now lets Start to the Code. and first install the library that can get PrinterSettings
    • Goto Manage NuGets Package
    • and search and Install “System.Drawing.Common”
  • Code
            DataTable dt = new DataTable();  // declate datatable for temp. storage
            dt.Columns.Add("PrinterName"); // add column in datatable
                foreach (String printer in PrinterSettings.InstalledPrinters) // loop all printer properties get from your PC
                {
                    dt.Rows.Add(printer.ToString()); // stored printer name datatable
                }
            dataGridView1.DataSource = dt; // display all data from datatable to datagridview
  • Sample View

You can freely comment your idea to any suggestion for this blog. thank you and hoping can give a input knowledge for everyone.

Related Topics

4 Replies to “Get List of Printer Name installed in your PC’s (C Sharp)”

Leave a Reply

Your email address will not be published. Required fields are marked *