C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Refresh in Crystal Report Viewer


Posted Date: 07 Oct 2008    Resource Type: Articles    Category: .NET Framework

Posted By: Herryandi       Member Level: Bronze
Rating:     Points: 10




There are many cases in crystalreportviewer when we want to refresh the current report to get the new data, it always shows the parameter value form to ask the parameter value.

Currently I'm using crystalreport that was embedded from the microsoft visual studio 2005.

Although the button refresh is originally from the crystalreportviewer toolbar, but it wont automatically refresh without asking the parameter value, I have seen so many forum explaining this problem, but I cannot find the solution for this.

Finally I found out a way to solved this problems, There are 2 ways actually to solved this problem,

First is we make 1 dummy paramater, so everytime we click the refresh button, we always send the dummy parameter with different value from the previous value. By using this way, the crystalreportviewer will detect there is a changes in parameter value and it will refresh the data.

I know this way is not a good way, btw, another simple way is:

In button refres handle put this code:


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


As you can see, I create a new object called rpt, get the all value from the current reportviewer, set it to nothing for report source, fill in again the parameter fields, refresh the object (This is the key) and put it back into reportsource.

Try it, and feels the heaven.

Regards
Redsouljaz








Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Refresh report  .  Refresh crystalreport  .  Refresh  .  Crystalreportviewer  .  Crystalreport refresh  .  Crystalreport  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Create a CSV File using System.IO classes
Previous Resource: DotNet COM Interoperability
Return to Discussion Resource Index
Post New Resource
Category: .NET Framework


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

Help Desk

Contact Us    Privacy Policy    Terms Of Use