GdPicture.NET.14
GdPicture14 Namespace / GdViewer Class / PrintGetPrintersCount Method
Example





PrintGetPrintersCount Method (GdViewer)
Returns the number of all available (installed) printers on the computer.
Syntax
'Declaration
 
Public Function PrintGetPrintersCount() As Integer
 

Return Value

The number of available printers. The GdViewer.GetStat method can be subsequently used or the GdViewer.PrintGetStat method to determine if this method has been successful.
Remarks
It is recommend to use the GdViewer.GetStat method or the GdViewer.PrintGetStat method to identify the specific reason for the method's failure, if any.
Example
How to find out the number of currently installed printers on your computer.
'We assume that the GdViewer1 control has been properly integrated.
Dim PrintersCount As Integer = GdViewer1.PrintGetPrintersCount()
If GdViewer1.GetStat() = GdPictureStatus.OK Then
    Dim CurPrinter As String = GdViewer1.PrintGetActivePrinter()
    If GdViewer1.GetStat() = GdPictureStatus.OK Then
        MessageBox.Show("The number of available printers: " + PrintersCount.ToString() + vbCrLf + "The currently active printer is: " + CurPrinter, "GdViewer.PrintGetPrintersCount")
    Else
        MessageBox.Show("The PrintGetActivePrinter() method has failed with the status: " + GdViewer1.PrintGetStat(), "GdViewer.PrintGetPrintersCount")
    End If
Else
    MessageBox.Show("The PrintGetPrintersCount() method has failed with the status: " + GdViewer1.PrintGetStat(), "GdViewer.PrintGetPrintersCount")
End If
See Also