Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

How to: Print a Vertical Grid and Show its Print Preview

The following example demonstrates how to print a Vertical Grid or show its Print Preivew. To do this, you should use either the VGridControlBase.Print or VGridControlBase.ShowPrintPreview methods.

Note

The Vertical Grid can be printed and previewed only if the XtraPrinting Library is available. To verify that printing the Vertical Grid is possible, use the VGridControlBase.IsPrintingAvailable property.

using DevExpress.XtraVerticalGrid;
// ...

private void ShowVerticalGridPreview(VGridControl vGrid) {
    // Check whether the Vertical Grid can be previewed.
    if (!vGrid.IsPrintingAvailable) {
        MessageBox.Show("The 'DevExpress.XtraPrinting' library is not found", "Error");
        return;
    }

    // Open the Preview window.
    vGrid.ShowPrintPreview();
}

private void PrintVerticalGrid(VGridControl vGrid) {
    // Check whether the Vertical Grid can be printed.
    if (!vGrid.IsPrintingAvailable) {
        MessageBox.Show("The 'DevExpress.XtraPrinting' library is not found", "Error");
        return;
    }

    // Print.
    vGrid.Print();
}