Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9164

How to release ReportDocument or CrystalReportViewer instances ?

$
0
0

In a large WPF application using Crystal Report for Visual Studio 13.0.10, i detect that instances of CrystalReporViewer and ReportDocument are not released. I reproduce this in the small join application.

 

The code :

 

Imports CrystalDecisions.CrystalReports.Engine

Imports CrystalDecisions.Shared Class MainWindow   

 

Private Sub buPreview_Click(sender As Object, e As RoutedEventArgs)

 

Handles buPreview.Click       

'Création des données       

Dim listPerson As New List(Of Person)      

 

listPerson.Add(New Person With {.Name = "Denis", .PhoneNumber = "0473"})       

listPerson.Add(New Person With {.Name = "Laurent", .PhoneNumber = "0473"})       

listPerson.Add(New Person With {.Name = "Fred", .PhoneNumber = "0473"})       

listPerson.Add(New Person With {.Name = "Jean", .PhoneNumber = "0473"})      

 

'Création du report       

Dim R As New reportdocument       

R.Load("CrystalReport1.rpt")       

R.SetDataSource(listPerson)       

 

'Aperçu       

Dim wCR As New WindowPreview      

wCR.CRV.Owner = Window.GetWindow(wCR)      

wCR.CRV.ViewerCore.ReportSource = R       

wCR.ShowDialog()       

 

'Nettoyage       

wCR.CRV.Dispose()      

wCR = Nothing       

R.Close()       

R.Dispose()       

R = Nothing   

End Sub

End Class

 

 

I try a lot of thing without success and memory profile indicates instances number increase after each preview Can you help me please ?

 

Message was edited by: Don Williams Formatted the code - Copy it into Notepad and then paste it in and it removed the formatting tags.


Viewing all articles
Browse latest Browse all 9164

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>