TabControlCancelEventArgs.Action Egenskap

Definition

Hämtar ett värde som anger vilken händelse som inträffar.

public:
 property System::Windows::Forms::TabControlAction Action { System::Windows::Forms::TabControlAction get(); };
public System.Windows.Forms.TabControlAction Action { get; }
member this.Action : System.Windows.Forms.TabControlAction
Public ReadOnly Property Action As TabControlAction

Egenskapsvärde

Ett av TabControlAction värdena.

Exempel

Följande kodexempel visar hur den här medlemmen används. I exemplet rapporterar en händelsehanterare om händelsens TabControl.Selecting förekomst. Den här rapporten hjälper dig att lära dig när händelsen inträffar och kan hjälpa dig att felsöka. Om du vill rapportera om flera händelser eller händelser som inträffar ofta kan du överväga att MessageBox.Show ersätta med Console.WriteLine eller lägga till meddelandet i en flerradig TextBox.

Om du vill köra exempelkoden klistrar du in den i ett projekt som innehåller en instans av typen TabControl med namnet TabControl1. Kontrollera sedan att händelsehanteraren är associerad med TabControl.Selecting händelsen.

private void TabControl1_Selecting(Object sender, TabControlCancelEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "TabPage", e.TabPage );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "TabPageIndex", e.TabPageIndex );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Action", e.Action );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Cancel", e.Cancel );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "Selecting Event" );
}
Private Sub TabControl1_Selecting(sender as Object, e as TabControlCancelEventArgs) _ 
     Handles TabControl1.Selecting

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "TabPage", e.TabPage)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "TabPageIndex", e.TabPageIndex)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Action", e.Action)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Cancel", e.Cancel)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"Selecting Event")

End Sub

Gäller för

Se även