Results 1 to 4 of 4

Thread: [RESOLVED] DataGridView horizontal scroll bars not appearing

Hybrid View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    May 2004
    Location
    South Charleston, WV, USA
    Posts
    607

    Resolved [RESOLVED] DataGridView horizontal scroll bars not appearing

    I am instantiating a datagridview with code on a form. It works but there is no horizontal scroll bar to allow showing of the right side of the dgv. I can tab through the fields and show the right side that way. But there is no scroll bar. There is a vertical scroll bar, but no horizontal scroll bar.

    The datagridview is created with the following:

    Code:
            ReportDataGridView = New DoubleBufferedDataGridView
            ReportDataGridView.Name = "Stock Items Report"
            ReportDataGridView.Left = 14
            ReportDataGridView.Top = 90
            ReportDataGridView.Height = 520
            ReportDataGridView.Width = 956
            ReportDataGridView.BorderStyle = BorderStyle.None
            ReportDataGridView.RowsDefaultCellStyle.SelectionBackColor = Color.DarkKhaki
            ReportDataGridView.RowsDefaultCellStyle.SelectionForeColor = Color.Black
            ReportDataGridView.RowsDefaultCellStyle.BackColor = Color.LightYellow
            ReportDataGridView.RowsDefaultCellStyle.Font = New Font("Microsoft Sans Serif", 12)
            ReportDataGridView.AlternatingRowsDefaultCellStyle.BackColor = Color.PaleGoldenrod
            ReportDataGridView.ColumnHeadersDefaultCellStyle.Font = New Font("Microsoft Sans Serif", 11)
            ReportDataGridView.ColumnHeadersHeight = 28
            ReportDataGridView.AllowUserToAddRows = False
            ReportDataGridView.AllowUserToDeleteRows = False
            ReportDataGridView.AllowUserToOrderColumns() = True
            ReportDataGridView.ReadOnly = True
            AddHandler ReportDataGridView.CellClick, AddressOf ReportDataGridView_CellClick
    
            Controls.Add(ReportDataGridView)
    I have tried adding

    Code:
    ReportDataGridView.ScrollBars = ScrollBars.Both
    and
    Code:
    ReportDataGridView.ScrollBars = ScrollBars.Horizontal
    but neither worked. Maybe a width property I'm missing? If somebody could let me know that would be great.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: DataGridView horizontal scroll bars not appearing

    Does it behave the same way if you use a standard DataGridView instead of that derived type?

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    May 2004
    Location
    South Charleston, WV, USA
    Posts
    607

    Re: DataGridView horizontal scroll bars not appearing

    Yes, as far as the missing scroll bar is concerned.

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    May 2004
    Location
    South Charleston, WV, USA
    Posts
    607

    Re: DataGridView horizontal scroll bars not appearing

    After playing around with it, I have discovered that the parent MDI form wasn't tall enough! After adjusting this, all is well. Thanks for looking.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width