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