SelectedGridItemChangedEventArgs.OldSelection Propiedad

Definición

Obtiene la GridItem previamente seleccionada.

public:
 property System::Windows::Forms::GridItem ^ OldSelection { System::Windows::Forms::GridItem ^ get(); };
public System.Windows.Forms.GridItem OldSelection { get; }
public System.Windows.Forms.GridItem? OldSelection { get; }
member this.OldSelection : System.Windows.Forms.GridItem
Public ReadOnly Property OldSelection As GridItem

Valor de propiedad

Objeto GridItem anterior. Puede ser null.

Ejemplos

En el ejemplo de código siguiente se muestra el uso de este miembro. En el ejemplo, un controlador de eventos informa sobre la aparición del PropertyGrid.SelectedGridItemChanged evento. Este informe le ayuda a aprender cuándo se produce el evento y puede ayudarle a depurar. Para informar sobre varios eventos o eventos que se producen con frecuencia, considere la posibilidad de reemplazar MessageBox.Show por Console.WriteLine o anexar el mensaje a una línea TextBoxmúltiple.

Para ejecutar el código de ejemplo, péguelo en un proyecto que contenga una instancia de tipo PropertyGrid denominada PropertyGrid1. A continuación, asegúrese de que el controlador de eventos está asociado al PropertyGrid.SelectedGridItemChanged evento.

private void PropertyGrid1_SelectedGridItemChanged(Object sender, SelectedGridItemChangedEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "NewSelection", e.NewSelection );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "OldSelection", e.OldSelection );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "SelectedGridItemChanged Event" );
}
Private Sub PropertyGrid1_SelectedGridItemChanged(sender as Object, e as SelectedGridItemChangedEventArgs) _ 
     Handles PropertyGrid1.SelectedGridItemChanged

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "NewSelection", e.NewSelection)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "OldSelection", e.OldSelection)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"SelectedGridItemChanged Event")

End Sub

Se aplica a