How to Scroll to a certain row in DataGrid?

Disasterpiece

Well-known member
Joined
Apr 2, 2003
Messages
47
Location
Blacksburg, VA
Hi all, I need to scroll to the very bottom of my datagrid when I enter my program and stay at the bottom.

I tried the NavigateTo method but it requires a Row number (okay), and a Relation string (what is this??)

So then I tried the following code that I got from the Windows form FAQ:

Code:
     Public Class MyDataGrid 
 
      Inherits DataGrid 
 
          Sub ScrollToRow(ByVal row As Integer) 
 
               If Not Me.DataSource Is Nothing Then 
 
                    Me.GridVScrolled(Me, New ScrollEventArgs(ScrollEventType.LargeIncrement, row)) 
 
               End If 
 
          End Sub 
 
     End Class

No luck with this code. I added a new class to my project with that as the code. I think my problem with this is that I wasnt sure how to connect the instance of the class with the actual datagrid on my form.

Any help is appreciated

Thanks
 
To change from the DataGrid to your derived class. You must rename all occurrances of "DataGrid" to "MyDataGrid". That is the declare and the New one your code creates.
 
Back
Top