'Passing value to Crystal Report Section 3(Details)

I want to programmatically pass a value to Section 3(Details) of crystal report, to check if it'll work I first try it using a loop. Upon trying, details only shows the last number of the loop like: 5 5 5 5 I want number to be shown in sequence like this: 1 2 3 4 Please help, thanks in advance.

This is my code:

    srecord_rpt rptz;

            rptz = new srecord_rpt();

            DataSet ds = new DataSet();

            CrystalDecisions.CrystalReports.Engine.TextObject Text10, txt;

            Text10 = (CrystalDecisions.CrystalReports.Engine.TextObject)
                rptz.ReportDefinition.ReportObjects["Text10"];
            txt = (CrystalDecisions.CrystalReports.Engine.TextObject)
                rptz.ReportDefinition.ReportObjects["txt"];

            TextObject accntCode = (TextObject)rptz.ReportDefinition.Sections["Section3"].ReportObjects["txt"];
 
            Text10.Text = "Khevin";
            int i;
            for (i = 0; i < 5; i++ )
            {
                crystalReportViewer1.Refresh();
                accntCode.Text = i.ToString();
                
            }
            crystalReportViewer1.ReportSource = rptz;


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source