Refresh form

Exactly what do you mean by "refresh"? You need to be clear as we don't know what's in your head. The form has a Refresh method that redraws the form, but I doubt that that's what you mean.

If you mean refresh the data that's displayed in the form then there's no magic at all. Whatever you did to get the data in the first place, you simply do again.
 
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.
 
The Load event is raised BEFORE the form is displayed, so the Load event handler is executed before the form is displayed. It's the Shown event that gets raised immediately after the form is displayed so that's the event you should handle to show your export dialogue.

By the way, there's no way I ever would have guessed that that's what you meant from your first post. Remember to always provide full and clear descriptions, which your second post was, and then you're most likely to get the help you want.
 
That worked! Thanks a lot. Yeah sorry about my first post. I wasn't sure how to explain it. In the future I'll be sure to completely explain on my first post.
 
Back
Top