Click here to Skip to main content
15,905,508 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
for (int i =0 ; i <=dataGridView1.Rows.Count-1; i++)
Posted
Updated 31-Dec-12 6:15am
v2

1 solution

I think what your asking is how to skip the first 2 rows ?

If so just check the value of i before you execute any code in your loop,
 
Share this answer
 
Comments
zeshanazam 31-Dec-12 12:20pm    
how is it possible ??
DinoRondelly 31-Dec-12 12:31pm    
for (int i =0 ; i <=dataGridView1.Rows.Count-1; i++)
{
if( i > whatever row you wanted to start on)
{
Do whatever you want
}
}
AnteoDev 31-Dec-12 12:21pm    
for (int i =2 ; i <=dataGridView1.Rows.Count-1; i++) ???
zeshanazam 31-Dec-12 12:24pm    
and what if i want to skip first row ??
AnteoDev 31-Dec-12 12:27pm    
Set a variable before the loop, like this:

int rowsToSkip = 1;
for (int i = rowsToSkip ; i <=dataGridView1.Rows.Count-1; i++)
{
this.DoWork(datagridView1.Rows[i]);
}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900