Hi
I'd like to know "the right" way to monitoring accesibility on networkfolders.
using visual studio 2008.

First I was just looping through netvork folders - checking each with folderexists("\\serv1\uk\bla")

this was a timed loop - using timer..

I realized that mainform did freeze during folder check - especially when connected the network wireless.

Then.. I get the idea to use a Background Worker.
Never tried before - så I mananaged to make this bad code - seems to work..

Something like this


Private Sub TestWorker_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles TestWorker.DoWork
Do Until TestWorker.CancellationPending
TestWorker.ReportProgress(Value, MyFolderExists("C:\temp\uk"))
Threading.Thread.Sleep(200)
Loop
End Sub

Private Sub TestWorker_ProgressChanged(ByVal sender As Object, ByVal e As System.ComponentModel.ProgressChangedEventArgs) Handles TestWorker.ProgressChanged
LabelFoldrExists.Text = e.UserState
End Sub

I have app 10 folders by now I check.
Problem is freezing of mainform.

Can I add some kind of timeout shorter than system timeout if no network is present and the check just is waiting (for system timeout) 20 seconds..

Best Regards
lomax