CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2002

    Determine if a DataGridView's horizontal scroll bar exists?

    Visual Basic 2010, .NET 3.5 Is there a way to pragmatically determine if a DataGridView's horizontal scroll bar is active or visible? I need to move a few items about when the DGV's horizontal scroll bar comes on

  2. #2
    Join Date
    May 2013

    Re: Determine if a DataGridView's horizontal scroll bar exists?

    I played around with this and figured out how to determine if a scroll bar is visible, a horizontal scroll bar in the example below.

        Private Function HScrollBarVisible() As Boolean
            Dim ctrl As New Control
            For Each ctrl In DataGridView1.Controls
                If ctrl.GetType() Is GetType(HScrollBar) Then
                    If ctrl.Visible = True Then
                        Return True
                        Return False
                    End If
                End If
            Return Nothing
        End Function

Tags for this Thread

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.