title: The vertical scrollbar keeps disapearing on my DataGridView in C#
body: <p>We're building a Windows application in Visual Studio C# 2008 Express Edition, returning a data set from our server and displaying it in a DataGridView. Certain users are complaining that the vertical scroll bar keeps vanishing when they're working. They can restore it by closing down that screen and re-opening it.  </p>
  
  <p>We're struggling to debug this problem because it doesn't happen all the time and never happens to some users (including all of our developers).  </p>
  
  <p>When the scrollbar has vanished, it leaves the space that it occupied, but instead of displaying the control, we get a graduated blue colour (which looks very much line the backdrop of the screen at that point).  </p>
  
  <p>My initial feeling is that this could be a bug in the DataGridView control. Have any of you encountered such an error before? Can you offer any sugestions on where to start fixing it?  </p>
  
  <p>The code that we're running is:
  My collegue (who's developing this screen) has provided the following code for you: // // dGridJournal // this.dGridJournal.AllowUserToAddRows = false; this.dGridJournal.AllowUserToDeleteRows = false; this.dGridJournal.AllowUserToResizeRows = false; this.dGridJournal.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.dGridJournal.AutoGenerateColumns = false;
  dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
  dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; this.dGridJournal.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; this.dGridJournal.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dGridJournal.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.jrnhidDataGridViewTextBoxColumn, this.typedesc, this.pdateDataGridViewTextBoxColumn, this.narridDataGridViewTextBoxColumn, this.pvalueDataGridViewTextBoxColumn, this.authdesc}); 
  this.dGridJournal.DataCont = this.dataContJournalEnquiries; this.dGridJournal.DataSource = this.ttJRNHeaderBindingSource; dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Window; dataGridViewCellStyle3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.ControlText;
  dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.False; this.dGridJournal.DefaultCellStyle = dataGridViewCellStyle3; this.dGridJournal.LabelText = "Please enter mandatory criteria."; this.dGridJournal.Location = new System.Drawing.Point(4, 4); this.dGridJournal.ModifiedCellColor = System.Drawing.Color.SandyBrown; this.dGridJournal.MultiSelect = false;
  this.dGridJournal.Name = "dGridJournal"; this.dGridJournal.ReadOnly = true; dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control; dataGridViewCellStyle4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText; dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight;
  dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True; this.dGridJournal.RowHeadersDefaultCellStyle = dataGridViewCellStyle4; this.dGridJournal.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.dGridJournal.Size = new System.Drawing.Size(488, 95); this.dGridJournal.TabIndex = 1; this.dGridJournal.TabStop = false; this.dGridJournal.UpScroll = true;
  this.dGridJournal.SortStarted += new CapitaHartshead.Core.Controls.CHDataGridView.SortStartingHandler(this.dGridJournal_SortStarted); this.dGridJournal.SelectionChanged += new System.EventHandler(this.dGridJournal_SelectionChanged); // // jrnhidDataGridViewTextBoxColumn // this.jrnhidDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.ColumnHeader; this.jrnhidDataGridViewTextBoxColumn.DataPropertyName = "jrnhid"; this.jrnhidDataGridViewTextBoxColumn.HeaderText = "Journal Number"; 
  this.jrnhidDataGridViewTextBoxColumn.Name = "jrnhidDataGridViewTextBoxColumn"; this.jrnhidDataGridViewTextBoxColumn.ReadOnly = true; this.jrnhidDataGridViewTextBoxColumn.Width = 97; // // typedesc // this.typedesc.DataPropertyName = "typedesc"; this.typedesc.HeaderText = "Type"; this.typedesc.Name = "typedesc"; this.typedesc.ReadOnly = true; this.typedesc.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; this.typedesc.Width = 55; // // pdateDataGridViewTextBoxColumn // this.pdateDataGridViewTextBoxColumn.DataPropertyName = "pdate";
  this.pdateDataGridViewTextBoxColumn.HeaderText = "Date"; this.pdateDataGridViewTextBoxColumn.Name = "pdateDataGridViewTextBoxColumn"; this.pdateDataGridViewTextBoxColumn.ReadOnly = true; this.pdateDataGridViewTextBoxColumn.Width = 80; // // narridDataGridViewTextBoxColumn // this.narridDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.narridDataGridViewTextBoxColumn.DataPropertyName = "narr"; this.narridDataGridViewTextBoxColumn.HeaderText = "Description"; 
  this.narridDataGridViewTextBoxColumn.Name = "narridDataGridViewTextBoxColumn"; this.narridDataGridViewTextBoxColumn.ReadOnly = true; this.narridDataGridViewTextBoxColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; // // pvalueDataGridViewTextBoxColumn // this.pvalueDataGridViewTextBoxColumn.DataPropertyName = "pvalue"; dataGridViewCellStyle2.Format = "C2"; dataGridViewCellStyle2.NullValue = null; this.pvalueDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle2; this.pvalueDataGridViewTextBoxColumn.HeaderText = "Value"; 
  this.pvalueDataGridViewTextBoxColumn.Name = "pvalueDataGridViewTextBoxColumn"; this.pvalueDataGridViewTextBoxColumn.ReadOnly = true; this.pvalueDataGridViewTextBoxColumn.Width = 80; // // authdesc // this.authdesc.DataPropertyName = "authdesc"; this.authdesc.HeaderText = "State"; this.authdesc.Name = "authdesc"; this.authdesc.ReadOnly = true; this.authdesc.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; this.authdesc.Width = 50;</p>