1) myDataGrid.CurrentCell = New
DataGridCell(RowIndexYouWant,ColumnIndexYouWant);
2) Have you set default values for the underlying DataColums of the
DataTable? If so, they should be populating themselves when a new row is
added. For instance,
myDataSet.Tables["SomeTable"].Columns[SomeColumnIndex].DefaultValue =
"Whatever"; //In this
http://www.knowdotnet.com/articles/types.html Article
I'm discussing types but the example I use is regarding defaultvalues of
DataColumns which is what you'd need.
"Whatever should appear when you add a new row or if you're using a
BindingContext, when you call .AddNew
You may also want to set the Nulltext property of your DataGridColumnStyle
if you want those values to 'appear' in the grid but not actually be there.
If you use Defaults, then "Whatever" will actually get sent back to the db
(using the above example) as SomeColumnIndex in the new row when you call
Update. If you just wanted it to say "Whatever" but not be delivered back
to the DB, then use NullText instead of default value.
HTH,
Bill
HTH,
Bill
"Moshe Lupiansky via .NET 247" <an*******@dotnet247.com> wrote in message
news:OC*************@TK2MSFTNGP09.phx.gbl...
(Type your message here)
1 - How do I programmatically assign a value to a specified cell in a
DataGrid? Something like DataGrid1(3,8) = "ABC"
2 - When I am going to the last row (the empty one)in order to insert a
new record into the DB, I want the default values of the fields that do have
default values to be displayed when I first enter this row. How do I achieve
it? --------------------------------
From: Moshe Lupiansky
-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)
<Id>yvA6J0mFtUSQcmSEsmdsRg==</Id>