You use the DataColumn.DefaultValue property to provide default values for new rows. You access this property through the DataTable associated with the DataGrid,
[C#]
this.dataGrid1.DataSource = this._dataSet.Tables['orders'];
....
....
this._dataSet.Tables['Orders'].Columns[1].DefaultValue = 'CustID'; // default value for column 1
this._dataSet.Tables['Orders'].Columns['OrderDate'].DefaultValue = DateTime.Now; // default value for OrderDate column
[VB.NET]
Me.dataGrid1.DataSource = Me._dataSet.Tables('Orders')
....
....
Me._dataSet.Tables('Orders').Columns(1).DefaultValue = 'CustID' ’ default value for column 1
Me._dataSet.Tables('Orders').Columns('OrderDate').DefaultValue = DateTime.Now ’ default value for OrderDate column
Share with