-
Check if file exists
Hi!
Is there a way to determine if a file exists, in VB.NET? I'm not talking
about the try-and-see-if-I-get-an-error way, nor using the FileSystemObject.
Is there a built-in function in VB.NET that checks if a file exists?
/john
-
Re: Check if file exists
"John Knoop" <john.k@home.se> wrote in message news:3d974b78@10.1.10.29...
> Hi!
>
> Is there a way to determine if a file exists, in VB.NET? I'm not talking
> about the try-and-see-if-I-get-an-error way, nor using the FileSystemObject.
>
> Is there a built-in function in VB.NET that checks if a file exists?
>
> /john
Is there some reason you can't bring up Help and search for an
Exists property yourself? How about typing System.IO. in the
editor and using Intellisense to navigate to a few likely suspects?
Yes, there is a way to tell if a file exists, its in one of the System.IO.
classes. (Microsoft has taken special care to make these things
easily discoverable, get used to navigating the heirarchy)
LFS
-
Re: Check if file exists
> Is there some reason you can't bring up Help and search for an
> Exists property yourself?
Actually there is:
I do not have VB.NET installed on my computer :-)
/john
"Larry Serflaten" <serflaten@usinternet.com> wrote in message
news:3d978030@10.1.10.29...
> "John Knoop" <john.k@home.se> wrote in message news:3d974b78@10.1.10.29...
> > Hi!
> >
> > Is there a way to determine if a file exists, in VB.NET? I'm not talking
> > about the try-and-see-if-I-get-an-error way, nor using the
FileSystemObject.
> >
> > Is there a built-in function in VB.NET that checks if a file exists?
> >
> > /john
>
>
>
> Is there some reason you can't bring up Help and search for an
> Exists property yourself? How about typing System.IO. in the
> editor and using Intellisense to navigate to a few likely suspects?
>
> Yes, there is a way to tell if a file exists, its in one of the System.IO.
> classes. (Microsoft has taken special care to make these things
> easily discoverable, get used to navigating the heirarchy)
>
> LFS
>
>
>
>
>
-
Re: Check if file exists
"John Knoop" <john.k@home.se> wrote in news:3d9797a5@10.1.10.29:
>> Is there some reason you can't bring up Help and search for an
>> Exists property yourself?
>
> Actually there is:
> I do not have VB.NET installed on my computer :-)
>
> /john
>
Then try MSDN online. It's all there, y'know.
--
Rune Bivrin
- OOP since 1989
- SQL Server since 1990
- VB since 1991
-
Re: Check if file exists
System.IO.File.Exists(file) = True / False
"John Knoop" <john.k@home.se> wrote in message news:3d974b78@10.1.10.29...
> Hi!
>
> Is there a way to determine if a file exists, in VB.NET? I'm not talking
> about the try-and-see-if-I-get-an-error way, nor using the FileSystemObject.
>
> Is there a built-in function in VB.NET that checks if a file exists?
>
> /john
>
>
-
Re: Check if file exists
On Sun, 29 Sep 2002 21:16:39 +0200, "John Knoop" <john.k@home.se> wrote:
¤ Hi!
¤
¤ Is there a way to determine if a file exists, in VB.NET? I'm not talking
¤ about the try-and-see-if-I-get-an-error way, nor using the FileSystemObject.
¤
¤ Is there a built-in function in VB.NET that checks if a file exists?
You could also search for Dir (Microsoft.VisualBasic.FileSystem namespace) if you still want to use
the VB Classic functions.
Paul ~~~ pclement@ameritech.net
Microsoft MVP (Visual Basic)
-
Re: Check if file exists
Ahh! Thanks!
"Miroslav St. Jeliaskoff" <miroslav@earthling.net> wrote in message
news:3d98563c@10.1.10.29...
System.IO.File.Exists(file) = True / False
"John Knoop" <john.k@home.se> wrote in message news:3d974b78@10.1.10.29...
> Hi!
>
> Is there a way to determine if a file exists, in VB.NET? I'm not talking
> about the try-and-see-if-I-get-an-error way, nor using the
FileSystemObject.
>
> Is there a built-in function in VB.NET that checks if a file exists?
>
> /john
>
>
-
Response to questions
I think it might have been more polite to simple answer the person's question instead of berating them for not looking up elsewhere (they may not know about the "elsewheres".
-
Personnally, I think you should refrain from using anything in Microsoft.VisualBasic (Microsoft.VisualBasic.FileSystem) or its alternative My.Computer.FileSystem.
These have designed to provide some backward compatibility and help beginners.
They are very limited compared to what you can find in System.IO.File or System.IO.FileInfo (and Dir, and DirInfo and DriveInfo), and using those, you will not discover what is possible to do with files in .NET.
And if you ever switch to another .NET language, you will have to learn to use System.IO anyway, so why not do it now while you are working in a language that is easier to learn than most.
Jacques Bourgeois
JBFI
http://www3.sympatico.ca/jbfi/homeus.htm
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|