Posted by: Red Souldier | February 28, 2009

Error when click refresh in crystalreportviewer

Refresh Button

Refresh Button

currently using visual studio.net  2005 vb.net.

As you know that visual studio provide crystalreportviewer as well when we installed it.

But there is a problem with the refresh button in crystalreportviewer. This button suppose to work as a refresing data in crystalreportviewer when there is an update data without any coding behined. When I click this button, it shows error msg that makes the program hang crap shit. Panic happen, what in the red hell is going on with this shit. This thing supposed to work automatically cos its embedded in the viewer.

I can’t remember what version is the crystalreportviewer installed. But for some version this thing does not happen. But most of my friends encounter this problem, they just dont realize until I asked them to check it hihihihihihi.

There are 2 solution for this problem:

1. Add parameter value in your report, when the refresh button click, send different value from the previous value. For example previous value is 1 then after click refresh send 2. This will refresh the value, although this value is only dummy data.

2. Is more nice one hehehhe, add this code in ReportRefresh event:

Private Sub CrReportViewer_ReportRefresh(ByVal source As Object, ByVal e As CrystalDecisions.Windows.Forms.ViewerEventArgs) Handles CrReportViewer.ReportRefresh

Dim rpt As Object

e.Handled = True

rpt = Me.CrReportViewer.ReportSource

CrReportViewer.ReportSource = Nothing

CrReportViewer.ParameterFieldInfo = rpt.ParameterFields

rpt.Refresh()

CrReportViewer.ReportSource = rpt

End Sub

and walla, it works daaaa. So I assume this is bugs from some of version crystalreportviewer

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: