DataGridViewCell.DataGridViewCellAccessibleObject.Value Property


获取或设置一个字符串,该字符串表示所属单元格的格式化值。Gets or sets a string representing the formatted value of the owning cell.

 virtual property System::String ^ Value { System::String ^ get(); void set(System::String ^ value); };
public override string Value { get; set; }
member this.Value : string with get, set
Public Overrides Property Value As String

Property Value


单元格值的 String 表示形式。A String representation of the cell value.


Owner 属性的值为 nullThe value of the Owner property is null.


Value 属性包含一个字符串,该字符串表示单元 FormattedValue 属性的值。The Value property contains a string that represents the value of the cell FormattedValue property. 如果 FormattedValue null,则 Value 包含字符串 "(null)"。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.

  • 使用单元 GetFormattedValueParseFormattedValue 方法将指定的值转换为单元 ValueType 属性所指示的类型。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.

Applies to

See also