I am using a DataGridView to store some search results but can't seem to get the scroll bar on the grid to work.
I have attribute ScrollBars set to Vertical.
- When results are added the bar appears and looks to be working as expected.
- If I scroll on the mouse it scrolls
- But if I try to interact with the bar it does nothing.
The only thing I am doing that is a bit odd is setting select to entire row as when one is selected it causes a popup.
Also note this is a Outlook add in using C# and Net-office but that probably makes no difference.
Any ideas?
As you can see the populated grid shows the toolbar you just cant use it
Code for adding the rows to the datagrid
if (mailItem.Parent is Outlook.MAPIFolder)
{
ParentFolder = mailItem.Parent as Outlook.MAPIFolder;
ResultGrd.Rows.Add(mailItem.EntryID, ParentFolder.FolderPath, mailItem.SenderName, mailItem.Subject, mailItem.SentOn);
}
Generated code about the datagrid so you can see what all the settings are:
//
// ResultGrd
//
this.ResultGrd.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.ResultGrd.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells;
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, 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.False;
this.ResultGrd.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
this.ResultGrd.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.ResultGrd.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.ItemEntityID,
this.FolderH,
this.SenderH,
this.SubjectH,
this.DateH});
this.ResultGrd.Location = new System.Drawing.Point(13, 151);
this.ResultGrd.Name = "ResultGrd";
this.ResultGrd.ReadOnly = true;
this.ResultGrd.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.ResultGrd.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.ResultGrd.Size = new System.Drawing.Size(996, 381);
this.ResultGrd.TabIndex = 4;
this.ResultGrd.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentClick);