Can't Insert New Row Between Row and Row While Existing DataTable Looping

K

Kelvin

Hi All,

While the existing datatable is looping, I can insert new row into
datatable, but I can't insert it between datarows. All new rows will
inserted into buttom row. Please advise!
 
M

Mohamoss

HI Kelvin
If you want to insert in arbitrary locations within your datatable., you
need to create DataRowCollection of the rows of your datatable
DataRowCollection r = mytable.Rows;
There are the function RemoveAt and InsertAt of the DataRowCollection Class
You can read more about that object on this link

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemdatadatarowcollectionclasstopic.asp
hope this helps
Mohamed Mahfouz
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top