Reference Guide
GdPicture14 Namespace / GdPictureImaging Class / PrintGetPrintersCount Method
Example





In This Topic
    PrintGetPrintersCount Method (GdPictureImaging)
    In This Topic
    Returns the number of all available (installed) printers on the computer.
    Syntax
    'Declaration
     
    
    Public Function PrintGetPrintersCount() As Integer
    public int PrintGetPrintersCount()
    public function PrintGetPrintersCount(): Integer; 
    public function PrintGetPrintersCount() : int;
    public: int PrintGetPrintersCount(); 
    public:
    int PrintGetPrintersCount(); 

    Return Value

    The number of available printers.
    Remarks
    We strongly recommend using the GetStat method or the PrintGetStat method to identify the specific reason for the method's failure.
    Example
    Changing the active printer.
    using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
    {
        int printCount = gdpictureImaging.PrintGetPrintersCount();
        string message = "The number of printers: " + printCount;
        if (printCount > 0)
        {
            gdpictureImaging.PrintSetActivePrinter(gdpictureImaging.PrintGetPrinterName(1));
            message += "\nThe active printer is: " + gdpictureImaging.PrintGetActivePrinter();
        }
        MessageBox.Show(message, "Active printer", MessageBoxButtons.OK, MessageBoxIcon.Information);
    }
    See Also