Hi Wilson,
If you want to programically call the scroll event, you can use the GridVScrolled method. If you check the DataGird.GridVScrolled method, you will find that this method calls an private the member function called "ScrollDown", which performs the real scroll event by calling the native ScrollWindow function; thus, you can leverage the existing DataGird.GridVScrolled method to programmatically scroll a DataGrid.
The DataGird.GridVScrolled method figures out how much rows to scroll down before calling the "ScrollDown" method. To do so, it needs the scrollEventArgs.NewValue property and several other internal members, so you can define a public method that accepts the "e" (ScrollEventArgs) parameter
and calls base.GridVScrolled method internally to scroll the DataGrid.
Public Class MyDataGrid
Inherits DataGrid
Sub ScrollToRow(ByVal row As Integer)
If Not Me.DataSource Is Nothing Then
Me.GridVScrolled(Me, New ScrollEventArgs(ScrollEventType.SmallIncrement, row))
End If
End Sub
End Class
>I think we are not understanding each other.
>
>this is my situation, I have a DataGridColumnStyle Class with a TextBox and a Button, in the class i add a Handler to the DataGridColumnStyle.TableStyle.DataGrid.Scroll, this handler hide the TextBox and The Button when the grid is scroll.
>
>what i want is from a event in a form force the DataGrid to call the Scroll event to disapear the TextBox and The Button, but i don't want to add a Method to the DataGridColumnStyle Class to do That.
>
>I found this ISystemDebugEventFire.FireEvent in The MSDN but i don't know how to use.
-----------------------------------------
Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.comwww.prenia.comWeblog: blogs.prenia.com/cathi