Click here to Skip to main content
11,934,809 members (48,397 online)
Rate this:
Please Sign up or sign in to vote.
See more: C#
for (i = 0; i <= dt.Rows.Count-1; i++)
                      int newRowIndex = ins.dataGridView1.Rows.Add();
                          ins.dataGridView1.Rows[newRowIndex].Cells["Loan_id"].Value = dt.Rows[i]["Loan_id"].ToString();
                          ins.dataGridView1.Rows[newRowIndex].Cells["Transaction_no"].Value = dt.Rows[i]["Transaction_no"].ToString();
                          ins.dataGridView1.Rows[newRowIndex].Cells["Installment_Amount"].Value = dt.Rows[i]["Installment_Amount"].ToString();
                          ins.dataGridView1.Rows[newRowIndex].Cells["Due_Date"].Value = dt.Rows[i]["Due_Date"].ToString();
                          ins.dataGridView1.Rows[newRowIndex].Cells["Transaction_Date"].Value = dt.Rows[i]["Transaction_Date"].ToString();
                          ins.dataGridView1.Rows[newRowIndex].Cells["Fine"].Value = dt.Rows[i]["Fine"].ToString();
                          ins.dataGridView1.Rows[newRowIndex].Cells["Paid_with_fine"].Value = dt.Rows[i]["Paid_with_fine"].ToString();
                          ins.dataGridView1.Rows[newRowIndex].Cells["Amount_recieved"].Value = dt.Rows[i]["Amount_recieved"].ToString();
                          ins.dataGridView1.Rows[newRowIndex].Cells["Paid_Amount"].Value = dt.Rows[i]["Paid_Amount"].ToString();
                          ins.dataGridView1.Rows[newRowIndex].Cells["Remaining_Amount"].Value = dt.Rows[i]["Remaining_Amount"].ToString();
                          ins.dataGridView1.Rows[newRowIndex].Cells["Customer_CNIC"].Value = dt.Rows[i]["Customer_CNIC"].ToString();
Posted 24-Dec-12 20:51pm
Orcun Iyigun 25-Dec-12 2:38am
Have you used the magic tool debugger? I think it is something related to this line: <pre lang="c#">int newRowIndex = ins.dataGridView1.Rows.Add();</pre>
zeshanazam 25-Dec-12 2:54am
problem occurring due to which line ?
Sandeep Mewara 25-Dec-12 6:23am
Debug and see if you are getting correct number of records from DB.
umermhr 26-Dec-12 5:44am
have you set datasource for Grid....???
A-s-h-l-e-y 30-Dec-12 2:49am
I think i know why but i'm not sure i like what your using this for...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web04 | 2.8.151126.1 | Last Updated 25 Dec 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100