C# Windows Mobile datagrid data

c++datagridwindows-mobile

I have a datagrid that has two columns. The DataSource for the datagrid is "myTable" which is a DataTable. All I am trying to do is add a row to the DataTable and have the new row be displayed in the datagrid. Here is the simple code I wrote to add the item to the DataTable:

DataRow dRow = myTable.NewRow();
dRow.ItemArray.SetValue("test", 0);
dRow.ItemArray.SetValue("test1", 1);

What am I missing to make the new data row show in the datagrid?

Thanks!

Best Solution

The .NewRow() method doesn't add the row to the table, it only returns a row with the appropriate fields included in it. You still need to add the row to the table.

myTable.Rows.Add(dRow);
Related Question