If I always need to call RemoveHandler after using AddHandler, where is the best place to do so?
I have searched several similar questions as follows, but I do not quite understand.
When and where to call the RemoveHandler in VB.NET?
AddHandler/RemoveHandler Not Disposing Correctly
I thought garbage collection in c# or vb.net will take care of unused objects. Also, in vb.net designer, it automatically generates Dispose Sub. So I did not pay attention to programally releasing resource at all. Will I have any memory leak problems? Please kindly provide me some links/documents for me to start learning.
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
Thanks a lot!