DataGrid.Scroll Event
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Occurs when the user scrolls the DataGrid control.
public:
event EventHandler ^ Scroll;
public event EventHandler Scroll;
member this.Scroll : EventHandler
Public Custom Event Scroll As EventHandler
Event Type
Examples
The following code example demonstrates the use of this member.
// Create an instance of the 'Scroll' EventHandler.
private:
void CallScroll()
{
myDataGrid->Scroll += gcnew EventHandler( this, &MyDataGrid::Grid_Scroll );
}
// Raise the event when DataGrid is scrolled.
void Grid_Scroll( Object^ /*sender*/, EventArgs^ /*e*/ )
{
// String variable used to show message.
String^ myString = "Scroll event raised, DataGrid is scrolled";
// Show the message when scrolling is done.
MessageBox::Show( myString, "Scroll information" );
}
// Create an instance of the 'Scroll' EventHandler.
private void CallScroll()
{
myDataGrid.Scroll += new EventHandler(Grid_Scroll);
}
// Raise the event when DataGrid is scrolled.
private void Grid_Scroll(object sender, EventArgs e)
{
// String variable used to show message.
string myString = "Scroll event raised, DataGrid is scrolled";
// Show the message when scrolling is done.
MessageBox.Show(myString, "Scroll information");
}
' Create an instance of the 'Scroll' EventHandler.
Private Sub CallScroll()
AddHandler myDataGrid.Scroll, AddressOf Grid_Scroll
End Sub
' Raise the event when DataGrid is scrolled.
Private Sub Grid_Scroll(ByVal sender As Object, ByVal e As EventArgs)
' String variable used to show message.
Dim myString As String = "Scroll event raised, DataGrid is scrolled"
' Show the message when scrolling is done.
MessageBox.Show(myString, "Scroll information")
End Sub
Applies to
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.