Gets or sets a value indicating whether null values are allowed in this column for rows belonging to the table.
[Visual Basic] Public Property AllowNull As Boolean [C#] public bool AllowNull {get; set;} [C++] public: __property bool get_AllowNull(); public: __property void set_AllowNull(bool); [JScript] public function get AllowNull() : Boolean; public function set AllowNull(Boolean);
true if null values values are allowed; otherwise, false. The default is true.
If the Unique property is true, then one null value is allowed.
The OnPropertyChanged [member, System.Data.DataColumn] occurs when the change is successful.
The following example creates a new DataColumn and sets its AllowNull property to true.
[Visual Basic]
Private Sub AddNullAllowedColumn() Dim myColumn As DataColumn myColumn = New DataColumn("classID", System.Type.GetType("System.Int32")) myColumn.AllowNull = True ' Add the column to a new DataTable Dim myTable As DataTable myTable = New DataTable myTable.Columns.Add(myColumn) End Sub
DataColumn Class | DataColumn Members | System.Data Namespace | Unique | OnPropertyChanged