Ive done some google and stuff and i cant seem to figure this out. Try Catch just doesnt work the way i would expect it to.
here is the code.
DirectoryEntry Discover = new DirectoryEntry("WinNT://Workgroup");
foreach (DirectoryEntry Node in Discover.Children)
{
try {
if (Node.Properties.Count > 0)
{
//you have access to the computer so yeah
}
}
catch(System.IO.FileNotFoundException err) {
var ErrorMesage = err.Message;
//Yeah you dont have access to this computer, lets write a subroutine to allow the user to put in a username and password to access it
}
so when i run this i get a epic box popup and say something stupid like
{"The network path was not found.\r\n":null}