I have this code here that exports the XtraReport created to PDF File. But I get an error message that says "It is being used by another process."
Is there a way for me to avoid this error? I tried deleting the file by using System.IO.File.Delete but it keeps getting the error message. Also, considering that I really need to use the same file name.
here's the code:
Dim ReturnText As String = ""
Dim dtReport As DataTable = Nothing
Dim dtRows() As DataRow = Nothing
Dim XRPath As String = "reports/travel.repx"
Dim XRSubPath As String = "reports/travel_costallocation.repx"
Dim SQL As String = String.Empty
Dim xrBandTag As String = String.Empty
Dim xrGroupField As GroupField = Nothing
Dim xrProtectBands As String = "[BottomMargin][PageFooter][PageHeader][ReportHeader]"
Dim xrFilename As String = String.Empty
Dim xParams As Integer = 0
Dim dAccessTo As DataTable = Nothing
Dim bUpdate As Boolean = False
Dim ReportID As Integer = 0
Dim ReportData() As Object = Nothing
Dim Value() As String = Nothing
Dim xrReport As XtraReport = Nothing
'manipulate report here
xrReport.ExportToPdf(ServerPath & "\documents\travelpdf\eTravelNo_" & PathID & ".pdf")
Thank you for the advance help.