JasonDBurke
Programmer
Hello,
I'm attempting to insert new row data into a DataTable using the InsertAt method. What I want to do is have the new rows always appear first in the datagrid. When I stick this code behind a button and click repeatedly it works, however when I have this same code in a thread it does not insert correctly - it appends. Does it have anything to do with after the button click event is resolved somehow the datagrid is being reset as opposed to the code being in a thread? Below is the code.
DataRow myDataRow = myDataTable.NewRow();
myDataRow["Alert"] = "alert";
myDataTable.Rows.InsertAt(myDataRow,0);
dataGrid1.DataSource = myDataTable;
Thanks,
Jason
I'm attempting to insert new row data into a DataTable using the InsertAt method. What I want to do is have the new rows always appear first in the datagrid. When I stick this code behind a button and click repeatedly it works, however when I have this same code in a thread it does not insert correctly - it appends. Does it have anything to do with after the button click event is resolved somehow the datagrid is being reset as opposed to the code being in a thread? Below is the code.
DataRow myDataRow = myDataTable.NewRow();
myDataRow["Alert"] = "alert";
myDataTable.Rows.InsertAt(myDataRow,0);
dataGrid1.DataSource = myDataTable;
Thanks,
Jason