Export (0) Print
Expand All
Expand Minimize
0 out of 1 rated this helpful - Rate this topic

DataGridViewCell.ParseFormattedValue Method

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

Converts a value formatted for display to an actual cell value.

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

public virtual Object ParseFormattedValue (
	Object formattedValue,
	DataGridViewCellStyle cellStyle,
	TypeConverter formattedValueTypeConverter,
	TypeConverter valueTypeConverter
)
public Object ParseFormattedValue (
	Object formattedValue, 
	DataGridViewCellStyle cellStyle, 
	TypeConverter formattedValueTypeConverter, 
	TypeConverter valueTypeConverter
)
public function ParseFormattedValue (
	formattedValue : Object, 
	cellStyle : DataGridViewCellStyle, 
	formattedValueTypeConverter : TypeConverter, 
	valueTypeConverter : TypeConverter
) : Object

Parameters

formattedValue

The display value of the cell.

cellStyle

The DataGridViewCellStyle in effect for the cell.

formattedValueTypeConverter

A TypeConverter for the display value type, or a null reference (Nothing in Visual Basic) to use the default converter.

valueTypeConverter

A TypeConverter for the cell value type, or a null reference (Nothing in Visual Basic) to use the default converter.

Return Value

The cell value.
Exception typeCondition

ArgumentNullException

cellStyle is a null reference (Nothing in Visual Basic).

FormatException

The FormattedValueType property value is a null reference (Nothing in Visual Basic).

-or-

The ValueType property value is a null reference (Nothing in Visual Basic).

-or-

formattedValue cannot be converted.

ArgumentException

formattedValue is a null reference (Nothing in Visual Basic).

-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 a null reference (Nothing in Visual Basic) 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 implements the INullableValue interface, this method wraps the return value as a Nullable type.

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. All rights reserved.