Reference Guide
GdPicture14 Namespace / GdPictureImaging Class / PrintGetLastError Method
Example





In This Topic
    PrintGetLastError Method (GdPictureImaging)
    In This Topic
    Returns the error description of the last executed print operation, that has failed.
    Syntax
    'Declaration
     
    
    Public Function PrintGetLastError() As String
    public string PrintGetLastError()
    public function PrintGetLastError(): String; 
    public function PrintGetLastError() : String;
    public: string* PrintGetLastError(); 
    public:
    String^ PrintGetLastError(); 

    Return Value

    The description of the last printing error.
    Remarks
    The value resets to its default (an empty string) starting each new print job.
    Example
    Showing the error description of the last executed print operation, that has failed.
    using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
    {
        // Open an image file. An empty string allows the control to prompt for selecting a file.
        int imageID = gdpictureImaging.CreateGdPictureImageFromFile("");
     
        if (gdpictureImaging.Print(imageID) != GdPictureStatus.OK)
        {
            string errorMessage = gdpictureImaging.PrintGetLastError();
            Console.WriteLine("Error during printing: {0}", errorMessage);
        };
     
        // Release used resources.
        gdpictureImaging.ReleaseGdPictureImage(imageID);
    }
    using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
    {
        // Open an image file. An empty string allows the control to prompt for selecting a file.
        int imageID = gdpictureImaging.CreateGdPictureImageFromFile("");
     
        if (gdpictureImaging.PrintDialog(imageID) == false)
        {
            MessageBox.Show("Printing failed for " + gdpictureImaging.PrintGetDocumentName() +
                            "\nError: " + gdpictureImaging.PrintGetStat() +
                            "\nMessage: " + gdpictureImaging.PrintGetLastError(), "Printing status", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
        else
            MessageBox.Show("Printing succeded for " + gdpictureImaging.PrintGetDocumentName(), "Printing status", MessageBoxButtons.OK, MessageBoxIcon.Information);
     
        // Release used resources.
        gdpictureImaging.ReleaseGdPictureImage(imageID);
    }
    See Also