Hi all,

I found this snippet from syncfusion.com to programmatically scroll the datagrid to a particular row

VB Code:
  1. Public Class MyDataGrid
  2.        Inherits DataGrid
  3.            Sub ScrollToRow(ByVal row As Integer)
  4.                 If Not Me.DataSource Is Nothing Then
  5.                      Me.GridVScrolled(Me, New ScrollEventArgs(ScrollEventType.LargeIncrement, row))
  6.                 End If
  7.            End Sub
  8.       End Class

How can I incorporate this in my code. I have a form with a datagrid. If I remove public class to just retain the sub block:

VB Code:
  1. Sub ScrollToRow(ByVal row As Integer)
  2.                 If Not datagrid1.DataSource Is Nothing Then
  3.                      datagrid1.GridVScrolled(Me, New ScrollEventArgs(ScrollEventType.LargeIncrement, row))
  4.                 End If
  5. End Sub

i get an error:

D:\vendormst\vendor.vb(263): 'System.Windows.Forms.DataGrid.Protected Overridable Overloads Sub GridVScrolled(sender As Object, se As System.Windows.Forms.ScrollEventArgs)' is not accessible in this context because it is 'Protected'.

Could somebody help me to understand the concept protected, override, shadow, overloading. I've read a lot of topics about these but couldn't understand these fully.

Thanks a lot.