How to Loop Through a Particular Column in DataGridView( By Column Name)

Apr 17 2012 2:05 AM

Hi,
I need to loop through a specific column(Not all the columns) in DataGridview amd update some values: For Example I have dataGridView populated with a csv file and contains 4 column as

Name, Age, Asset
Martin,32,350
John,19,12
Joay,47,1200
humberto,50,950
Richardo,62,23

I present the cells value in DataGridView on a WinForm now I would like to loop through the Columns just by the Column Name. For example How i I can loop through Column = Age and find all ages under 30 and How I can loop throuh the Asset column and add 100 to all values lesss than 500.
Please be advise that I need to serch the column by COULMN NAME because I am not getting the Csv file in the same order as mentioned abouve so i have to use a loop which find the coulmns by thir name

Thanks a lot


Answers (4)