Export (0) Print
Expand All

DataGridViewCellParsingEventArgs.ParsingApplied Property

Note: This property is new in the .NET Framework version 2.0.

Gets or sets a value indicating whether a cell's value has been successfully parsed.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

public bool ParsingApplied { get; set; }
/** @property */
public boolean get_ParsingApplied ()

/** @property */
public void set_ParsingApplied (boolean value)

public function get ParsingApplied () : boolean

public function set ParsingApplied (value : boolean)

Property Value

true if the cell's value has been successfully parsed; otherwise, false. The default is false.

A DataGridViewCellParsingEventHandler sets the ParsingApplied property to indicate whether the new cell value was successfully parsed and no further conversion is necessary.

The following code example sets ParsingApplied to true when the cell's value is successfully parsed.

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

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2014 Microsoft