Hi everyone,
I apologise now if I come across as a newbie but its because I am
I've been using VB for exactly a week today and for that past 4 hours I've been pulling my hair out! My problem is that our software can only run on one PC on a site, if two instances are running they cause issues. So instead of checking each PC individually I created a program with VB to do this (and other tasks) for me. The problem with the network search is that if I cannot access a remote PC (usually access is denied) then it hangs for a long time before moving on to the next. Can I introduce a timeout feature where the program tries to access the c drive but if it does this for more than 5 seconds and gets nowhere then it moves on?
The code looks like this (red part being the part it hangs on)
If IO.Directory.Exists(testcpath) Then
If IO.File.Exists(netpath) Or IO.File.Exists(netpath2) Then
ListBox2.Items.Add(ListBox1.Items
)
End If
Else : End If
'testcpath' is \\pcname\c$ and the other two paths look for the software I'd need to remove if found. So basically, if I have access to every c drive it works fine and completes within a few minutes. If I don't have access to even a small amount then it takes an absolute age.
I've searched forums and google for the past 4 hours and come up with nothing that would help. Or maybe I've just overlooked something
Thanks in advance!
Johno
I apologise now if I come across as a newbie but its because I am
The code looks like this (red part being the part it hangs on)
If IO.Directory.Exists(testcpath) Then
If IO.File.Exists(netpath) Or IO.File.Exists(netpath2) Then
ListBox2.Items.Add(ListBox1.Items
End If
Else : End If
'testcpath' is \\pcname\c$ and the other two paths look for the software I'd need to remove if found. So basically, if I have access to every c drive it works fine and completes within a few minutes. If I don't have access to even a small amount then it takes an absolute age.
I've searched forums and google for the past 4 hours and come up with nothing that would help. Or maybe I've just overlooked something
Thanks in advance!
Johno