13,097,884 members (54,139 online)
Rate this:
See more:
```int rowskip = 1;
for (int i = rowskip; i <= dataGridView1.Rows.Count - 1; i++)
{
Double firsttotal = Convert.ToDouble(dataGridView1.Rows[i - 1].Cells[4].Value);
Double amount = Convert.ToDouble(dataGridView1.Rows[i].Cells[2].Value);
Double sum = firsttotal + amount;
dataGridView1.Rows[i].Cells[4].Value = sum.ToString();
}```
Posted 4-Jan-13 3:36am
Updated 6-Jan-13 8:25am
Jibesh17.7K
v3
OriginalGriff 4-Jan-13 9:43am

This is not a good question - we cannot work out from that little what you are trying to do.
What doesn't work?
What should it do that it isn't, or shouldn't it do that it is?
Use the "Improve question" widget to edit your question and provide better information.
zeshanazam 4-Jan-13 9:47am

can u just tell me to skip selected row to make for loop work ?

http://www.codeproject.com/Questions/521745/transferingplustheplustextplusfromplusdynamicallyp
can you help me sir please if you can

Rate this:

## Solution 1

Not too sure, but looks like you are talking of something like:
```if(! DataGridView1.SelectedRows.Contains(dataGridView1.Rows[i]))
{
// Do something
}
else
{
// This row is selected one!
}```

Refer: MSDN: DataGridView.SelectedRows Property [^]
Rate this:

## Solution 2

You have mentioned to skip the selected row in a gridview you can try something like below
```int rowskip = 1;
for (int i = rowskip; i <= dataGridView1.Rows.Count - 1; i++)
{

if( dataGridView1.Rows[i].Selected)
{
continue;// skip this row if its selected
}

Double firsttotal = Convert.ToDouble(dataGridView1.Rows[i - 1].Cells[4].Value);
Double amount = Convert.ToDouble(dataGridView1.Rows[i].Cells[2].Value);
Double sum = firsttotal + amount;
dataGridView1.Rows[i].Cells[4].Value = sum.ToString();
}```

Top Experts
Last 24hrsThis month
 Graeme_Grant 245 ProgramFOX 115 RickZeeland 105 ppolymorphe 85 Jochen Arndt 65
 OriginalGriff 4,219 Graeme_Grant 2,412 ProgramFOX 2,117 Jochen Arndt 1,860 ppolymorphe 1,820