|
-
Apr 19th, 2003, 08:19 AM
#1
Thread Starter
Registered User
how to remove an object that was created, dispose?!
In a program i made , an object is created during runtime, this object uses a timer inside( of its own ), when i dispose my object, the programs shows an error because the timer inside of it was still working .
why does this happen? when you dispose an object doesnt it dispose and kill everything that the object contains?!!
-
Apr 19th, 2003, 11:43 AM
#2
Sleep mode
Well , simply just call Dispose Property of that object like so :
VB Code:
Dim ad As New OleDb.OleDbDataAdapter()
'When you are done , do this to free up
ad.Dispose()
I don't know about your code but it seems you're doing some bad coding practice .
Last edited by Pirate; Apr 19th, 2003 at 11:55 AM.
-
Apr 19th, 2003, 11:52 AM
#3
Sleep mode
To have more elegant code , it highly recommended to include your unwanted resources in the Form's Dispose Method which looks similar to this one :
VB Code:
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
'Add this line and pass the object you want to dispose .
components.Add(A)
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
-
Apr 19th, 2003, 11:54 AM
#4
PowerPoster
The timer is executing on a different thread, so in your dispose method, make sure you stop the timer.
-
Apr 19th, 2003, 09:51 PM
#5
haj-agha, what object are you talking about anyways
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|