Binding.NullValue 属性

定义

获取或设置当数据源包含 Object 值时,作为控件属性设置的 DBNullGets or sets the Object to be set as the control property when the data source contains a DBNull value.

public:
 property System::Object ^ NullValue { System::Object ^ get(); void set(System::Object ^ value); };
public object NullValue { get; set; }
member this.NullValue : obj with get, set
Public Property NullValue As Object

属性值

当数据源包含 Object 值时,作为控件属性设置的 DBNullThe Object to be set as the control property when the data source contains a DBNull value. 默认值为 nullThe default is null.

注解

数据源必须包含 DBNull,才能正确应用 NullValue 属性。The data source must contain DBNull for the NullValue property to be correctly applied. 如果数据源类型是一个类型(如字符串或整数),则将忽略 NullValue 属性的值。If the data source type is a type such as a string or integer the value of the NullValue property will be ignored. 此外,如果将 NullValue 属性设置为 null,则会将其忽略。Also, the NullValue property is ignored if it is set to null.

如果将控件属性设置为 NullValue的对象,则会向数据源中添加 null 值。A null value will be added to the data source when the control property is set to the object of NullValue. 如果 NullValue 设置为字符串值,则比较不区分大小写。If NullValue is set to a string value, comparisons are case-insensitive.

适用于