G
Guest
hi all,
i have found out the problem but i could not find the solution yet.
code:
Public Class ReportProvider
dim dTable as DataTable
dim rprDoc as new ReportDocument()
public sub new(dataTable as DataTable)
me.dTable = dataTable
end sub
public sub generateReportDocument(byval ReportPath as string)
..
reportDocument.Load(ReportPath)
reportDocument.SetDataSource(dTable)
..
end sub
..
'after i used this class:
reportDocument.SetDataSource(Nothing)
reportDocument.dispose
reportDocument = Nothing
dTable.Dispose()
dTable = Nothing
GC.collect
..
end
as you can see from the code; i have a datatable and i set the datasource of
my reportDocument class with it. i dispose the datatable in reportProvider
class but reportDocument class already uses it. i must dispose it too but
..net does not allow me to access it. i can set datasource of reportdocument
class but i can not get and dispose it.
i want something like: when i dispose a form(or a class), all controls and
variables on it will be disposed too... or something like. i am disposing
report document but the datatable of report document is still on memory.
note: i dispose a variable but gc does not collect it. when i assigned it
"nothing" gc is collecting... so i must set the variable "nothing". disposing
is not enough... am i right?
thanks...
Ömer KUL
i have found out the problem but i could not find the solution yet.
code:
Public Class ReportProvider
dim dTable as DataTable
dim rprDoc as new ReportDocument()
public sub new(dataTable as DataTable)
me.dTable = dataTable
end sub
public sub generateReportDocument(byval ReportPath as string)
..
reportDocument.Load(ReportPath)
reportDocument.SetDataSource(dTable)
..
end sub
..
'after i used this class:
reportDocument.SetDataSource(Nothing)
reportDocument.dispose
reportDocument = Nothing
dTable.Dispose()
dTable = Nothing
GC.collect
..
end
as you can see from the code; i have a datatable and i set the datasource of
my reportDocument class with it. i dispose the datatable in reportProvider
class but reportDocument class already uses it. i must dispose it too but
..net does not allow me to access it. i can set datasource of reportdocument
class but i can not get and dispose it.
i want something like: when i dispose a form(or a class), all controls and
variables on it will be disposed too... or something like. i am disposing
report document but the datatable of report document is still on memory.
note: i dispose a variable but gc does not collect it. when i assigned it
"nothing" gc is collecting... so i must set the variable "nothing". disposing
is not enough... am i right?
thanks...
Ömer KUL