private void previewMenuItem_Click(object sender, System.EventArgs e)
 {
     gridPrinter.Prepare_To_Print();
     if (this.printPreviewDialog1.ShowDialog() == DialogResult.OK)
     {
     }
 }
        private void print_grid_style_report(bool All_Rows)
        {
            // Save the flag
            gridPrinterShowAllRows = All_Rows;

            try
            {
                // If there are too many rows, ask for confirmation
                if ((gridPanel.View_Count > 500) && (All_Rows))
                {
                    DialogResult result = MessageBox.Show("You are about to print a report with " + gridPanel.View_Count + " rows.\n\nAre you sure you want to do this?", "Large Print Job Warning!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                    if (result != DialogResult.Yes)
                    {
                        return;
                    }
                }

                if ((gridPanel.Selected_Row_Count > 500) && (!All_Rows))
                {
                    DialogResult result = MessageBox.Show("You are about to print a report with " + gridPanel.Selected_Row_Count + " rows.\n\nAre you sure you want to do this?", "Large Print Job Warning!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                    if (result != DialogResult.Yes)
                    {
                        return;
                    }
                }

                // Print this report
                gridPrinter.Prepare_To_Print();
                pageSetupDialog1.PageSettings.Landscape = SMaRT_UserSettings.Item_Grid_Print_Landscape;
                if (printDialog1.ShowDialog() == DialogResult.OK)
                {
                    SMaRT_UserSettings.Item_Grid_Print_Landscape = pageSetupDialog1.PageSettings.Landscape;
                    SMaRT_UserSettings.Save();
                    printDocument1.Print();
                }
            }
            catch
            {
                MessageBox.Show("Error encountered while printing!       ", "I/O Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }