please someone should loop this code for me in c#.

double chick2 = (Convert.ToDouble(f2.dataGridView1[1, 0].Value)) * (Convert.ToDouble(f2.dataGridView1[3, 0].Value));
dataGridView1[4, 0].Value = chick2;
dataGridView1[5, 0].Value = chick2;
dataGridView1[6, 0].Value = chick2;
dataGridView1[7, 0].Value = chick2;
dataGridView1[8, 0].Value = chick2;

they all have same value and i dont know how to loop it.
kinda new

Recommended Answers

This is typically something for a for loop. Loop from 4 to 8.

Jump to Post

All 2 Replies

This is typically something for a for loop. Loop from 4 to 8.

use something like this 
for(int j=0;j<datagridView2.Rows.Count;j++)
{
//get the values from various cells here
string name  = datagridView2.Rows[j].Cells["Name"].Value.ToString();
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.