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

Hybrid View

  1. #1
    Join Date
    Nov 2002
    Posts
    278

    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
    Posts
    5

    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.

    Code:
        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
                    Else
                        Return False
                    End If
                End If
            Next
            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
  •  





Click Here to Expand Forum to Full Width

Featured