Bahubali Gane

Bahubali Gane

  • NA
  • 48
  • 1.3k

how to build for loop for my code

Apr 7 2016 12:36 AM
guys plz help me, i dont know how to build a for loop for my code
 
following is my code
 
dataGridView1.Rows.Add();
dataGridView1.Rows[0].Cells[0].Value = dt.Rows[0][0].ToString();
dataGridView1.Rows[0].Cells[1].Value = dt.Rows[0][1].ToString();
dataGridView1.Rows[0].Cells[2].Value = dt.Rows[0][2].ToString();
dataGridView1.Rows[0].Cells[3].Value = dt.Rows[0][3].ToString();
dataGridView1.Rows[0].Cells[4].Value = dt.Rows[0][4].ToString();
dataGridView1.Rows[0].Cells[5].Value = dt.Rows[1][4].ToString();
dataGridView1.Rows[0].Cells[6].Value = dt.Rows[2][4].ToString();
dataGridView1.Rows[0].Cells[7].Value = dt.Rows[3][4].ToString();
dataGridView1.Rows[0].Cells[8].Value = dt.Rows[0][5].ToString();
dataGridView1.Rows[0].Cells[9].Value = dt.Rows[0][6].ToString();
above code is for one data row, i have more than 1000 rows. i think it is possible through only for loop, please anybody help me, thank u in advance
 

Answers (9)