DataGridViewCellParsingEventArgs.ParsingApplied Propiedad

Definición

Obtiene o establece un valor que indica si se analizó correctamente el valor de una celda.

C#
public bool ParsingApplied { get; set; }

Valor de propiedad

Boolean

Es true si el valor de la celda se ha analizado correctamente; de lo contrario, es false. De manera predeterminada, es false.

Ejemplos

En el ejemplo de código siguiente se establece ParsingApplied true en cuando el valor de la celda se analiza correctamente.

C#
// Handling CellParsing allows one to accept user input, then map it to a different
// internal representation.
private void dataGridView1_CellParsing(object sender, DataGridViewCellParsingEventArgs e)
{
    if (this.dataGridView1.Columns[e.ColumnIndex].Name == "Release Date")
    {
        if (e != null)
        {
            if (e.Value != null)
            {
                try
                {
                    // Map what the user typed into UTC.
                    e.Value = DateTime.Parse(e.Value.ToString()).ToUniversalTime();
                    // Set the ParsingApplied property to 
                    // Show the event is handled.
                    e.ParsingApplied = true;
                }
                catch (FormatException)
                {
                    // Set to false in case another CellParsing handler
                    // wants to try to parse this DataGridViewCellParsingEventArgs instance.
                    e.ParsingApplied = false;
                }
            }
        }
    }
}

Comentarios

DataGridViewCellParsingEventHandler Establece la ParsingApplied propiedad para indicar si el nuevo valor de celda se ha analizado correctamente y no es necesario realizar ninguna conversión adicional.

Se aplica a

Producto Versiones
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8
Windows Desktop 3.0, 3.1, 5, 6, 7

Consulte también