Click here to Skip to main content
15,923,689 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralCommand line arguments Pin
NetDave9-Mar-03 10:59
NetDave9-Mar-03 10:59 
GeneralRe: Command line arguments Pin
Hesham Amin9-Mar-03 21:05
Hesham Amin9-Mar-03 21:05 
GeneralRe: Command line arguments Pin
NetDave12-Mar-03 9:57
NetDave12-Mar-03 9:57 
GeneralMDI prob Pin
Ashwin C9-Mar-03 2:41
Ashwin C9-Mar-03 2:41 
GeneralRe: MDI prob Pin
mikasa10-Mar-03 9:24
mikasa10-Mar-03 9:24 
GeneralMultiple Instances of a class Pin
Nicholas Cardi8-Mar-03 9:51
Nicholas Cardi8-Mar-03 9:51 
GeneralRe: Multiple Instances of a class Pin
Ray Cassick8-Mar-03 10:27
Ray Cassick8-Mar-03 10:27 
GeneralRe: Multiple Instances of a class Pin
Nicholas Cardi10-Mar-03 20:11
Nicholas Cardi10-Mar-03 20:11 
Here hope this helps clarify things a bit more.

(Psudo code to follow)

Public Class frmMain
'This the standard windows form code
Private m_FileMon as clsMyFileMon

Private sub_cmdStart_Click

m_FileMon = new clsMyFileMon

End Sub

End Class

Public Class clsMyFileMon
Imports System.IO
Imports System.Timers
Imports System.Diagnostics

Public Sub New

'Starting new timers and a new instance of
'the filesystem watcher. Using AddHandler
'to add event handlers for the timer_tick event and
'the filesystemwatcher created event.

End sub

End Class

'I am watching for the creation of files in a specific folder
'then after a given amount of time I delete those files
End Class

So here is the problem. Every time I click cmdStart it is
starting another instance of my class. I know this because for every click of cmdStart I am getting another set of timers. The old instance is not being cleaned up. I have tried to kill the old instance by m_FileMon = Nothing, but the Finalize event does not fire.

Is this because the timers and the filesystemwatch are executing on different threads?
Do I need to implement IDispose to unhook the timers from my object and force the
garbage collector to kill my class?

Any help would be greatly appriciated.

Forever Developing
GeneralValidating a VAT number Pin
mcm8-Mar-03 2:07
mcm8-Mar-03 2:07 
GeneralRe: Validating a VAT number Pin
Hesham Amin8-Mar-03 10:51
Hesham Amin8-Mar-03 10:51 
GeneralRe: Validating a VAT number Pin
Anonymous10-Mar-03 6:45
Anonymous10-Mar-03 6:45 
GeneralInherits LicenseProvider Pin
Duncan Edwards Jones7-Mar-03 23:18
professionalDuncan Edwards Jones7-Mar-03 23:18 
GeneralExtract required information from downloaded web pages Pin
zulqarnain7-Mar-03 6:55
zulqarnain7-Mar-03 6:55 
GeneralRe: Extract required information from downloaded web pages Pin
Hesham Amin7-Mar-03 11:02
Hesham Amin7-Mar-03 11:02 
GeneralUsing .dll's created in Visual C++ in VB [both forums] Pin
dazinith6-Mar-03 5:43
dazinith6-Mar-03 5:43 
GeneralRe: Using .dll's created in Visual C++ in VB [both forums] Pin
Hesham Amin6-Mar-03 22:31
Hesham Amin6-Mar-03 22:31 
GeneralRe: Using .dll's created in Visual C++ in VB [both forums] Pin
Nick Parker7-Mar-03 7:04
protectorNick Parker7-Mar-03 7:04 
GeneralRe: Using .dll's created in Visual C++ in VB [both forums] Pin
Daniel Turini8-Mar-03 0:41
Daniel Turini8-Mar-03 0:41 
GeneralError while loading document object reference not set to an instance of an object Pin
DODO6-Mar-03 3:42
DODO6-Mar-03 3:42 
GeneralRe: Error while loading document object reference not set to an instance of an object Pin
Ray Cassick6-Mar-03 4:35
Ray Cassick6-Mar-03 4:35 
GeneralRe: Error while loading document object reference not set to an instance of an object Pin
Danny Blanchard6-Mar-03 9:45
Danny Blanchard6-Mar-03 9:45 
GeneralRe: Error while loading document object reference not set to an instance of an object Pin
Nic Rowan6-Mar-03 20:05
Nic Rowan6-Mar-03 20:05 
GeneralRe: Error while loading document object reference not set to an instance of an object Pin
DODO9-Mar-03 0:13
DODO9-Mar-03 0:13 
GeneralRe: Error while loading document object reference not set to an instance of an object Pin
nguyentuancuong9-Mar-03 14:43
nguyentuancuong9-Mar-03 14:43 
GeneralRe: Error while loading document object reference not set to an instance of an object Pin
silverbeam10-Mar-03 10:10
silverbeam10-Mar-03 10:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.