S
steve
Hi All
I need some advice on the correct way to dispose of an object after use
I am using VB2005
e.g
-------------------------------------------------------------------------------------------------------
dim dt as new datatable, sql as string
try
sql = "select * from ...."
dt = getdata(sql) ' my sub for retrieving data
do some stuff.....
catch ex as oledbexception
msgbox(ex.message)
finally
if not dt is nothing then
dt.dispose
dt = nothing
end if
end try
-------------------------------------------------------------------------------------------------------------
1. Do I need to set dt to nothing after calling the dispose method??
2. If an object does not have a dispose method, is setting it to nothing
sufficient to release resources?
3. VB 2005 no longer requires declaring a form variable before showing it.
Do you still have to destroy it with frm1.dispose and frm1 = nothing?
Regards
steve
I need some advice on the correct way to dispose of an object after use
I am using VB2005
e.g
-------------------------------------------------------------------------------------------------------
dim dt as new datatable, sql as string
try
sql = "select * from ...."
dt = getdata(sql) ' my sub for retrieving data
do some stuff.....
catch ex as oledbexception
msgbox(ex.message)
finally
if not dt is nothing then
dt.dispose
dt = nothing
end if
end try
-------------------------------------------------------------------------------------------------------------
1. Do I need to set dt to nothing after calling the dispose method??
2. If an object does not have a dispose method, is setting it to nothing
sufficient to release resources?
3. VB 2005 no longer requires declaring a form variable before showing it.
Do you still have to destroy it with frm1.dispose and frm1 = nothing?
Regards
steve