Condividi tramite


DataGrid.Navigate Evento

Definizione

Si verifica quando l'utente passa a una nuova tabella.

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 

Tipo evento

Esempio

Nell'esempio di codice seguente viene illustrato l'uso di questo membro.

   // 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

Commenti

Usare l'evento Navigate per reimpostare le proprietà delle singole colonne, ad esempio la larghezza, in base alle esigenze della tabella.

Si applica a