private void PrinterGridView_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (!Program.selectionChanged)
     {
         PrinterGridView.ClearSelection();
         Program.selectedX        = -1;
         Program.selectedY        = -1;
         Program.selectionChanged = true;
     }
     else
     {
         Program.selectionChanged = false;
     }
 }
        public void StopUpdating()
        {
            // InvokeRequired required compares the thread ID of the
            // calling thread to the thread ID of the creating thread.
            // If these threads are different, it returns true.
            if (this.statusStrip.InvokeRequired)
            {
                StopUpdatingCallback d = new StopUpdatingCallback(StopUpdating);
                try
                {
                    this.Invoke(d, new object[] { });
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex.StackTrace);
                    Application.Exit();
                }
            }
            else
            {
                //Program.printerBindingSource.DataSource = Program.printerTableLast;
                //if (!Program.updatingTable)
                //{
                Program.updatingTable      = true;
                PrinterGridView.DataSource = Program.printerTableLast;
                //PrinterGridView.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.None;
                if (sortingColumn != null)
                {
                    PrinterGridView.Sort(sortingColumn, sortingDirection);
                }
                ConditionalFormatting();
                SelectCell(Program.selectedY, Program.selectedX);
                //SelectCellCollection();

                Program.updatingTable = false;
                //}
                //PrinterGridView.Sort(this.printerNameDataGridViewTextBoxColumn, ListSortDirection.Ascending);
            }
        }