Think line 8 of your first code post never gets executed.
j=19 and so is Columns.Count so the condition in youfor statement: j < dataGridView1.Columns.Count; will end the for loop.
BTW. It is a bad habit to use hardcoded numbers in your code.
But I confess, sometimes I still have bad habits too.:icon_evil:
ddanbe
Senior Poster
3,829 posts since Oct 2008
Reputation Points: 2,070
Solved Threads: 661