12,509,148 members (55,688 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.4K
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
 OriginalGriff 364 Maciej Los 195 Suvendu Shekhar Giri 170 CPallini 140 Richard Deeming 125
 OriginalGriff 7,891 ppolymorphe 4,062 Maciej Los 3,921 David_Wimbley 3,196 Karthik Bangalore 3,121

Web02 | 2.8.160927.1 | Last Updated 6 Jan 2013