If you are using a derived DataGrid, then you can check the Visible property on the protected VertScrollBar property of DataGrid. So, you could check Me.VertScrollBar.Visible from within your derived DataGrid.
To check it without access to the protected scrollbar properties is a little more work, but possible. One technique is to loop through the Controls property of the DataGrid looking for the scrollbar, and then checking its visible property at that time. Here's a method that illustrates the technique.
[C#]
private bool IsScrollBarVisible( Control control )
{
foreach( Control c in control.Controls )
if ( c.GetType().Equals( typeof( VScrollBar ) ) )
return c.Visible;
return false;
}
[Visual Basic]
Private Function IsScrollBarVisible(ByVal control As Control) As Boolean
For Each c As Control In control.Controls
If c.GetType() Is GetType(VScrollBar) Then
Return c.Visible
End If
Next
Return False
End Function
Contributed from George Shepherd's Windows Forms FAQ