Public Class Form2
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
strsql = "select * from table1"
acscmd.CommandText = strsql
acscmd.Connection = acsconn
acsda.SelectCommand = acscmd
acsda.Fill(acsds)
strreprotname = "Report1"
Dim strreportpath As String = Application.StartupPath & "\" & strreprotname & ".rpt"
If Not IO.File.Exists(strreportpath) Then
Throw (New Exception("unable to locate report file: " & vbCrLf & strreportpath))
End If
Dim rptdocument As New CrystalDecisions.CrystalReports.Engine.ReportDocument
rptdocument.Load(strreportpath)
rptdocument.SetDataSource(acsds.Tables(0))
CrystalReportViewer1.ShowRefreshButton = False
CrystalReportViewer1.ShowCloseButton = False
CrystalReportViewer1.ShowGroupTreeButton = False
CrystalReportViewer1.ReportSource = rptdocument
End Sub
End Class