Click here to Skip to main content
15,353,547 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I'm trying generate a certain report using crystal report

my code is working just fine but my problem is its only limited to 9 reports while i have to create like 50+ reports.

can anybody help me or recommend some better code to use?

im using visual basic 2010

What I have tried:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim CRYRPT As New ReportDocument
        Dim CRTABLELOGONINFOS As New TableLogOnInfos
        Dim CRTABLELOGONINFO As New TableLogOnInfo
        Dim CRCONNECTIONINFO As New ConnectionInfo
       
        Dim dt As New DataTable  
        With dt
            .Columns.Add("Schoolname")
            .Columns.Add("KM")
            .Columns.Add("KF")
            .Columns.Add("KT")
            .Columns.Add("G1M")
            .Columns.Add("G1F")
            .Columns.Add("G1T")
            .Columns.Add("G2M")
            .Columns.Add("G2F")
            .Columns.Add("G2T")
            .Columns.Add("G3M")
            .Columns.Add("G3F")
            .Columns.Add("G3T")
            .Columns.Add("G4M")
            .Columns.Add("G4F")
            .Columns.Add("G4T")
            .Columns.Add("G5M")
            .Columns.Add("G5F")
            .Columns.Add("G5T")
            .Columns.Add("G6M")
            .Columns.Add("G6F")
            .Columns.Add("G6T")
            .Columns.Add("ESTOTAL")
            .Columns.Add("SY")

        End With

        For Each dgr As DataGridViewRow In Me.ElementaryDatagridview.Rows
            dt.Rows.Add(dgr.Cells(0).Value, dgr.Cells(1).Value, dgr.Cells(2).Value, dgr.Cells(3).Value, dgr.Cells(4).Value, dgr.Cells(5).Value, dgr.Cells(6).Value, dgr.Cells(7).Value, dgr.Cells(8).Value, dgr.Cells(9).Value, dgr.Cells(10).Value, dgr.Cells(11).Value, dgr.Cells(12).Value, dgr.Cells(13).Value, dgr.Cells(14).Value, dgr.Cells(15).Value, dgr.Cells(16).Value, dgr.Cells(17).Value, dgr.Cells(18).Value, dgr.Cells(19).Value, dgr.Cells(20).Value, dgr.Cells(21).Value, dgr.Cells(22).Value, dgr.Cells(23).Value)

        Next




        Dim ReportDocument As CrystalDecisions.CrystalReports.Engine.ReportDocument
        ReportDocument = New CrystalReport1
        ReportDocument.SetDataSource(dt)
        Generate_Elem.CrystalReportViewer1.ReportSource = ReportDocument
        Generate_Elem.ShowDialog()
        Generate_Elem.Dispose()
    End Sub
Posted
Comments
Maciej Los 22-Jul-21 3:12am
   
Sorry, but i can't get you... What you mean by stating: "my code is working just fine but my problem is its only limited to 9 reports while i have to create like 50+ reports."? Can you explain in details what you mean?
Beginner213456 22-Jul-21 4:08am
   
i mean i can open the crystal report using these codes. it displays the correct value i designed.... but my database have i 50+ data to display yet it can only display 9 data from my database.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900