Rediger

Del via


DataGrid.Navigate Event

Definition

Occurs when the user navigates to a new table.

public:
 event System::Windows::Forms::NavigateEventHandler ^ Navigate;
public event System.Windows.Forms.NavigateEventHandler Navigate;
member this.Navigate : System.Windows.Forms.NavigateEventHandler 
Public Custom Event Navigate As NavigateEventHandler 

Event Type

Examples

The following code example demonstrates the use of this member.

   // Instantiate the 'Navigate' NavigateEventHandler.
private:
   void CallNavigate()
   {
      myDataGrid->Navigate += gcnew NavigateEventHandler( this, &MyDataGrid::Grid_Navigate );
   }

   // Raise the event when navigating to another table.
private:
   void Grid_Navigate( Object^ /*sender*/, NavigateEventArgs^ /*e*/ )
   {
      // String variable used to show message.
      String^ myString = "Navigate event raised, moved to another table";
      
      // Show the message when navigating to another table.
      MessageBox::Show( myString, "Table navigation information" );
   }
// Instantiate the 'Navigate' NavigateEventHandler.
private void CallNavigate()
{
   myDataGrid.Navigate += new NavigateEventHandler(Grid_Navigate);
}

// Raise the event when navigating to another table.
private void Grid_Navigate(object sender, NavigateEventArgs e)
{
   // String variable used to show message.
   string myString = "Navigate event raised, moved to another table";
   // Show the message when navigating to another table.
   MessageBox.Show(myString, "Table navigation information");
}
' Create an instance of the 'Navigate' NavigateEventHandler.
Private Sub CallNavigate()
   AddHandler myDataGrid.Navigate, AddressOf Grid_Navigate
End Sub


' Raise the event when navigating to another table.
 Private Sub Grid_Navigate(ByVal sender As Object, ByVal e As NavigateEventArgs)
     ' String variable used to show message.
     Dim myString As String = "Navigate event raised, moved to another table"
     ' Show the message when navigating to another table.
     MessageBox.Show(myString, "Table navigation information")
 End Sub

Remarks

Use the Navigate event to reset individual column properties, such as width, as appropriate to the table.

Applies to