<font color="#0000ff" size=2>
Hi
I have a data table , which gets populated at the end of a certain transaction with say 30 Rows. Now depending upon the condition the user selects, i wanted to delete certain rows as given below.But the thing here happening is, first time the fifth row gets deleted,the row count is getting changed in the table to 29, which is playing the trick here as we can see that when next delete statement isencountered, there is no row with index 29 which is throwing an error and some times the row which i want to delete is not getting deleted, instead another row with altered index is getting deleted.How can we have a workaround for this situation? My intention is just to delete the rows at the specified index from the original output table.
if</font><font size=2> (Condition</font><font size=2>)
{
Table.Rows[5].Delete();
Table.Rows[29].Delete();
Table.Rows[12].Delete();
Table.Rows[13].Delete();
Table.Rows[19].Delete();
Table.Rows[20].Delete();
Table.Rows[26].Delete();
Table.Rows[27].Delete();
}
Thanks!
</font>
View the full article
Hi
I have a data table , which gets populated at the end of a certain transaction with say 30 Rows. Now depending upon the condition the user selects, i wanted to delete certain rows as given below.But the thing here happening is, first time the fifth row gets deleted,the row count is getting changed in the table to 29, which is playing the trick here as we can see that when next delete statement isencountered, there is no row with index 29 which is throwing an error and some times the row which i want to delete is not getting deleted, instead another row with altered index is getting deleted.How can we have a workaround for this situation? My intention is just to delete the rows at the specified index from the original output table.
if</font><font size=2> (Condition</font><font size=2>)
{
Table.Rows[5].Delete();
Table.Rows[29].Delete();
Table.Rows[12].Delete();
Table.Rows[13].Delete();
Table.Rows[19].Delete();
Table.Rows[20].Delete();
Table.Rows[26].Delete();
Table.Rows[27].Delete();
}
Thanks!
</font>
View the full article