DataGridViewCell.DataGridViewCellAccessibleObject.Value Property

 

Gets or sets a string representing the formatted value of the owning cell.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public override string Value {
	[SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
	get;
	[SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
	set;
}

Property Value

Type: System.String

A String representation of the cell value.

Exception Condition
InvalidOperationException

The value of the Owner property is null.

The Value property contains a string that represents the value of the cell FormattedValue property. If FormattedValue is null, Value contains the string "(null)".

Setting this property has no effect if the owning cell is a header cell, is read-only, or does not belong to a row. Otherwise, setting this property:

  • Ends any edit currently in progress and commits the value.

  • Uses the cell GetFormattedValue and ParseFormattedValue methods to convert the specified value to the type indicated by the cell ValueType property.

  • Sets the cell value to the converted value.

SecurityPermission

to call unmanaged code. Demand value: Demand. Permission value: UnmanagedCode

.NET Framework
Available since 2.0
Return to top
Show: