Incrementing Serial Number in PDF Creation - ASP.NET

I am generating a PDF using ITextSharp in ASP.NET. I need to display a table, with some data and Serial No auto incremented. I tried the following (using loop - increment) but it doesn't seem to work.

Dim dsGetStudentFeeDetails = dbl.usp_GetFeeReceiptDetailsForStudent(sid).AsQueryable

        For Each f1 In dsGetStudentFeeDetails
            Dim i As Integer = 1
            stuName = New PdfPCell(FormatPhrase(i))
            'stuName.Colspan = 4
            'stuName.Border = 0
            stuName.NoWrap = True
            stuName.HorizontalAlignment = Element.ALIGN_LEFT
            pdftable4.AddCell(stuName)

            stuName = New PdfPCell(FormatPhrase(f1.FeeAmountPaidDate))
            'stuName.Colspan = 4
            'stuName.Border = 0
            stuName.NoWrap = True
            stuName.HorizontalAlignment = Element.ALIGN_LEFT
            pdftable4.AddCell(stuName)

            i = i + 1
        Next

When I run through this during execution, I noticed that the i = i + 1 doesn't get incremented. Why so?

Answers


you have to declare and set default value Above for loop use below code

Dim dsGetStudentFeeDetails = dbl.usp_GetFeeReceiptDetailsForStudent(sid).AsQueryable
          Dim i As Integer = 1
        For Each f1 In dsGetStudentFeeDetails

            stuName = New PdfPCell(FormatPhrase(i))
            'stuName.Colspan = 4
            'stuName.Border = 0
            stuName.NoWrap = True
            stuName.HorizontalAlignment = Element.ALIGN_LEFT
            pdftable4.AddCell(stuName)

            stuName = New PdfPCell(FormatPhrase(f1.FeeAmountPaidDate))
            'stuName.Colspan = 4
            'stuName.Border = 0
            stuName.NoWrap = True
            stuName.HorizontalAlignment = Element.ALIGN_LEFT
            pdftable4.AddCell(stuName)

            i = i + 1
        Next

Need Your Help

Is there an easier way to make many inputs equal one?

javascript

Ok so at the moment I'm writing a script where you have to put how often something happens and the script I've used "Monthly" to signify once a month.

C++ Destructor deleting stuff(objects, pointers?) too soon

c++ templates destructor

I have an assignment that creates nodes and a inserts them into a doubly linked list. One of the specifications is to include a destructor. For some reason my destructor seems to be deleting either...