2
Answers

Delete all alternating rows from a DGV

Ricardo Carvalho

Ricardo Carvalho

16y
2.1k
1
Hi all.

I have a bit of a nasty task on hand at the moment. I have a datagridview which when loaded gets its data source from an Excel Spreadsheet. Now that part works fine. However, the idea behind this specific form is to be able to clean the spread sheet up and make certain changes to it. I know that the user can do it in excel, however, There are some things which need to be done by automation and not manually.

For example. The idea here is that when a user gets an age analysis from Quickbooks, the spread sheet which it pumps the data to, uses two lines for one client. however, We need to have only one line per client in the spread sheet which will then be used to import into another application. The problem is, that some of the clients have up to 5000 users in their system. (thus making the spread sheet 10 000 rows). No one in there right mind would "like" to sit and manually delete every second row. So now, I need to find a way to do it in an application.

Is there any one who has an idea on how I can go about deleting every second row in a dgv. Like I said, I can get the data from excel, I can display it in the dgv. Now, I need a button click event to be able to remove every second row. Once the alternating rows have been removed, I will then export the dgv to a new Excel Spread sheet. (No Prob there).

Thanks in advance.
Ricardo
Answers (2)