共用方式為


DataGridBoolColumn.AllowNull 屬性

定義

取得或設定一個值,表示是否允許空值。

public:
 property bool AllowNull { bool get(); void set(bool value); };
public bool AllowNull { get; set; }
member this.AllowNull : bool with get, set
Public Property AllowNull As Boolean

屬性值

true 若允許空值,否則 false。 預設值為 true

範例

以下程式碼範例設定了屬性 AllowNull

void SetAllowNull()
{
   DataGridBoolColumn^ myGridColumn = dynamic_cast<DataGridBoolColumn^>(dataGrid1->TableStyles[ 0 ]->GridColumnStyles[ 0 ]);
   myGridColumn->AllowNull = false;
}
private void SetAllowNull(){
    DataGridBoolColumn myGridColumn = (DataGridBoolColumn)dataGrid1.TableStyles[0].GridColumnStyles[0];
    myGridColumn.AllowNull = false;
 }
Private Sub SetAllowNull()
    Dim myGridColumn As DataGridBoolColumn = CType(dataGrid1.TableStyles(0).GridColumnStyles(0), DataGridBoolColumn)
    myGridColumn.AllowNull = False
End Sub

備註

當此屬性設為 false 時,欄位中的勾選框只有兩個狀態:勾true選()與未勾選(false)。

適用於

另請參閱