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
Printable View
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
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