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
Vivek Bansod142 reputationPosted Apr 6, 2016, 8:56 PM EDT
Nishant MittalRank #692 · 3.5K reputationPosted Apr 6, 2016, 8:59 PM EDT
Vivek Bansod142 reputationPosted Apr 6, 2016, 10:44 PM EDT
Vivek Bansod142 reputationPosted Apr 6, 2016, 10:45 PM EDT
Bahubali Gane43 reputationPosted Apr 6, 2016, 9:41 PM EDT
Bahubali Gane43 reputationPosted Apr 6, 2016, 9:46 PM EDT
Bahubali Gane43 reputationPosted Apr 6, 2016, 9:46 PM EDT
Bahubali Gane43 reputationPosted Apr 6, 2016, 9:46 PM EDT
Bahubali Gane43 reputationPosted Apr 6, 2016, 11:24 PM EDT
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts