Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Converts a value formatted for display to an actual cell value.
public:
virtual System::Object ^ ParseFormattedValue(System::Object ^ formattedValue, System::Windows::Forms::DataGridViewCellStyle ^ cellStyle, System::ComponentModel::TypeConverter ^ formattedValueTypeConverter, System::ComponentModel::TypeConverter ^ valueTypeConverter);
public virtual object ParseFormattedValue(object formattedValue, System.Windows.Forms.DataGridViewCellStyle cellStyle, System.ComponentModel.TypeConverter formattedValueTypeConverter, System.ComponentModel.TypeConverter valueTypeConverter);
public virtual object? ParseFormattedValue(object? formattedValue, System.Windows.Forms.DataGridViewCellStyle cellStyle, System.ComponentModel.TypeConverter? formattedValueTypeConverter, System.ComponentModel.TypeConverter? valueTypeConverter);
abstract member ParseFormattedValue : obj * System.Windows.Forms.DataGridViewCellStyle * System.ComponentModel.TypeConverter * System.ComponentModel.TypeConverter -> obj
override this.ParseFormattedValue : obj * System.Windows.Forms.DataGridViewCellStyle * System.ComponentModel.TypeConverter * System.ComponentModel.TypeConverter -> obj
Public Overridable Function ParseFormattedValue (formattedValue As Object, cellStyle As DataGridViewCellStyle, formattedValueTypeConverter As TypeConverter, valueTypeConverter As TypeConverter) As Object
The display value of the cell.
The DataGridViewCellStyle in effect for the cell.
A TypeConverter for the display value type, or null
to use the default converter.
A TypeConverter for the cell value type, or null
to use the default converter.
The cell value.
cellStyle
is null
.
The FormattedValueType property value is null
.
-or-
The ValueType property value is null
.
-or-
formattedValue
cannot be converted.
formattedValue
is null
.
-or-
The type of formattedValue
does not match the type indicated by the FormattedValueType property.
When the user edits a cell value and commits the change, the DataGridView control calls this method to convert the displayed value from the FormattedValueType to the ValueType. The control then sets the underlying cell value or data source value to the converted value.
The default implementation of this method parses the formattedValue
parameter using the NullValue, DataSourceNullValue, and FormatProvider properties of the cell style indicated by the cellStyle
parameter.
If formattedValue
is equal to NullValue, this method returns the value of the DataSourceNullValue property or null
if DataSourceNullValue is DBNull.Value and the cell ValueType is a reference type.
If formattedValue
is not equal to NullValue, this method parses formattedValue
using the FormatProvider property and the specified or default converters.
If the cell ValueType is nullable, this method wraps the return value as a Nullable<T> type.
Product | Versions |
---|---|
.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, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Please sign in to use this experience.
Sign in