excel Problem working with background program

  • Thread starter Thread starter ahmeddc
  • Start date Start date
A

ahmeddc

Guest
hi

I exported the Data GridView file to Excel and the code works well
The problem I have after the completion of the program is cumbersome and slow down the work of the program as a whole
I put the following codes in the last code but nothing

excelBook.Close()
xlApp.Quit()

releaseObject(xlApp)
releaseObject(excelBook)
releaseObject(excelWorksheet)

Public Sub releaseObject(ByVal obj As Object)
Try
System.Runtime.InteropServices.Marshal.ReleaseComObject(obj)
obj = Nothing
Catch ex As Exception
obj = Nothing
Finally
GC.Collect()
GC.WaitForPendingFinalizers()
End Try
End Sub

Continue reading...
 
Back
Top