TheMagician Posted April 20, 2004 Posted April 20, 2004 Hi all I have a datatable that essentially works like this (containing numbers): Title |Column1|Column 2|...... |Column n|TOTAL| Name 1 Name 2 .... Name n TOTAL (ie it is essentially a 2D array with totals) I want to remove each row that has a value in the total column of zero, and then remove each column that has a value in the total row of zero. (or vice versa - its irrelevant) I think this is an example where an enumerator is a good idea (correct me if I am wrong) but I am unsure how to implement it. Simply iterating through the rows causes errors because when you remove one the index numbers and row/column count change and obviously it throws exceptions. Any advice would be very much appreciated. Cheers TheMagician Quote
JABE Posted April 20, 2004 Posted April 20, 2004 Use the Select method of the datatable to retrieve all unwanted rows. This will return an array of datarows w/c you can remove one at a time via theDataTable.Rows.Remove method. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.