Wrox Home  
Search P2P Archive for: Go

  Return to Index  

ado_dotnet thread: Help With System.IO


Message #1 by "Tony Arslan" <tarslan@n...> on Mon, 23 Dec 2002 17:48:28 -0600
Hello All:
I seem to have a strange problem. I am trying to see if a directory on the
Network exist or not. I know it does exist and I know It is shared. I can
see it going from "My Network Places". But When I write the following code
It fails (It returns false)
Here is the code:
		  'Itlaptop is the name of the machine on the network that I
am trying to access
		  'Tandem is the name of the shared folder
	        Dim source As DirectoryInfo = New
DirectoryInfo("\\Itlaptop\Tandem")
	        If source.Exists() Then
            	outError.Text = "Itlaptop\Tandem exists on the server."
        	  End If

		  I Also tried the other object "Directory" it failed too. 
		  Here is the code for Directory. About the same.
	        If Directory.Exists("\\Itlaptop\Tandem") Then
            	outError.Text = "Itlaptop\Tandem exists on the server."
        	  End If

Please help me. If you rather email me privately, please do so. Thanks very
much in advance. 

Note: If I use FileSystemObject (Scripting Object) I don't have this
problem. nice old days..::))

Tony Arslan



Message #2 by "Dave Buckner" <Dave@n...> on Tue, 24 Dec 2002 04:57:09 -0600
Tony,

This here works for me, be sure to import system.io

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
        If Directory.Exists("\\titan\updates") Then
            MessageBox.Show("Exists!")
        Else
            MessageBox.Show("net share not found!")
        End If
    End Sub

Best regards,
Dave

-----Original Message-----
From: Tony Arslan [mailto:tarslan@n...]
Sent: Monday, December 23, 2002 5:48 PM
To: ADO.NET
Subject: [ado_dotnet] Help With System.IO
Importance: High


Hello All:
I seem to have a strange problem. I am trying to see if a directory on 
the
Network exist or not. I know it does exist and I know It is shared. I 
can
see it going from "My Network Places". But When I write the following 
code
It fails (It returns false) Here is the code:
		  'Itlaptop is the name of the machine on the network that I
am trying to access
		  'Tandem is the name of the shared folder
	        Dim source As DirectoryInfo =3D New
DirectoryInfo("\\Itlaptop\Tandem")
	        If source.Exists() Then
            	outError.Text =3D "Itlaptop\Tandem exists on the server."
        	  End If

		  I Also tried the other object "Directory" it failed too.
		  Here is the code for Directory. About the same.
	        If Directory.Exists("\\Itlaptop\Tandem") Then
            	outError.Text =3D "Itlaptop\Tandem exists on the server."
        	  End If

Please help me. If you rather email me privately, please do so. Thanks 
very
much in advance.

Note: If I use FileSystemObject (Scripting Object) I don't have this
problem. nice old days..::))

Tony Arslan




=3D=3D=3D
Fast Track ADO.NET with C# is a concise introduction to the concepts,
techniques, and libraries that you will need in order to start using 
ADO.NET
in your applications. The book covers DataSets and Typed DataSets, 
accessing
data using DataReaders and DataAdaptors, the close relationship between
ADO.NET and XML, how and where to use ADO.NET in your enterprise
applications, and how to use Web Services and ADO.NET to easily pass 
data
between applications. http://www.wrox.com/books/1861007604.htm



Message #3 by "Tony Arslan" <tarslan@n...> on Thu, 26 Dec 2002 09:18:06 -0600
Dave,
I found a new thing...:) The code works in Windows Form but it does not 
work
on Web Forms Just to remind you the code, .... Yes, I Imported System.IO
Namespace on both places...

    Private Sub btnFolderExist_Click(ByVal sender As System.Object, 
ByVal e
As System.EventArgs) Handles btnFolderExist.Click
        If Directory.Exists("\\Itlaptop\Tandem") Then
            Label1.Text =3D "Exists!!!, Hahahah!!!"
            'MessageBox.Show("Exists!")
        Else
            Label1.Text =3D "net share not found!"
            'MessageBox.Show("net share not found!")
        End If

On Windows Form, it returns "Exists!!!, Hahahah!!!"
On Web Forms, it returns "net share not found!"

I don't know what the problem is... Please help!
Thanks very much for your time..
Tony


Subject: RE: Help With System.IO
From: "Dave Buckner" <Dave@n...>
Date: Tue, 24 Dec 2002 04:57:09 -0600
X-Message-Number: 3

Tony,

This here works for me, be sure to import system.io

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
        If Directory.Exists("\\titan\updates") Then
            MessageBox.Show("Exists!")
        Else
            MessageBox.Show("net share not found!")
        End If
    End Sub

Best regards,
Dave

-----Original Message-----
From: Tony Arslan [mailto:tarslan@n...]=3D20
Sent: Monday, December 23, 2002 5:48 PM
To: ADO.NET
Subject: [ado_dotnet] Help With System.IO
Importance: High


Hello All:
I seem to have a strange problem. I am trying to see if a directory on 
=3D the
Network exist or not. I know it does exist and I know It is shared. I 
=3D can
see it going from "My Network Places". But When I write the following 
=3D code
It fails (It returns false) Here is the code:
		  'Itlaptop is the name of the machine on the network that I
am trying to access
		  'Tandem is the name of the shared folder
	        Dim source As DirectoryInfo =3D3D New
DirectoryInfo("\\Itlaptop\Tandem")
	        If source.Exists() Then
            	outError.Text =3D3D "Itlaptop\Tandem exists on the server."
        	  End If

		  I Also tried the other object "Directory" it failed
too.=3D20
		  Here is the code for Directory. About the same.
	        If Directory.Exists("\\Itlaptop\Tandem") Then
            	outError.Text =3D3D "Itlaptop\Tandem exists on the server."
        	  End If

Please help me. If you rather email me privately, please do so. Thanks 
=3D
very much in advance.=3D20

Note: If I use FileSystemObject (Scripting Object) I don't have this
problem. nice old days..::))

Tony Arslan




  Return to Index