Sorry. Guess I wasn't very clear.
Here is what I am trying to do. I have a form that has a crystal report viewer control on it. When the user clicks a button it loads the form and then I want the export report dialog box to automatically show.
I am using this code in my button click on another form
Dim FrmReportViewer As New FormReportViewer
FrmReportViewer.intPatientID = CInt(dgSearch.Item(dgSearch.CurrentRowIndex, 0))
FrmReportViewer.Show()
Then I have done this on the actual form that views the report.
Private Sub FormReportViewer_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim x As Integer
Me.Cursor = Cursors.WaitCursor
objRptPCR.GenerateReport(intPatientID)
'Set the data source for each subreport to the dataset that was created
For x = 0 To patientCareReport.Subreports.Count - 1
patientCareReport.Subreports(x).SetDataSource(objRptPCR.dsPCR)
Next
Me.Cursor = Cursors.Default
CrystalReportViewer1.ReportSource = patientCareReport
'If modGlobal.myExportReport = "Y" Then
' CrystalReportViewer1.ExportReport()
'End If
End Sub
Private Sub CrystalReportViewer1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Load
CrystalReportViewer1.Refresh()
CrystalReportViewer1.ShowFirstPage()
CrystalReportViewer1.ExportReport()
End Sub
What happens is it brings up the dialog box first then after I am done saving or cancelling it displays the form...not what I want.
I want the Form to load and the report to load in the viewer then the export dialog box to pop up.