Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > Visual Basic 2005 Basics
Visual Basic 2005 Basics If you are new to Visual Basic programming with version 2005, this is the place to start your questions. For questions about the book: Beginning Visual Basic 2005 by Thearon Willis and Bryan Newsome, ISBN: 0-7645-7401-9 please, use this forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2005 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old November 30th, 2006, 02:44 PM
Friend of Wrox
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default What’s the .NET Way to test if Folder Exists?

Easy enough in VB6, but the .NET way?
Old November 30th, 2006, 02:54 PM
Authorized User
Join Date: Nov 2006
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to ef1196

If My.Computer.FileSystem.DirectoryExists("C:\Temp") Then
    '* Do something
End If

Best Regards,
Earl Francis
Old January 12th, 2007, 01:41 PM
Wrox Author
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons

Imports System.IO

Private Sub foo()
  If Directory.Exists("c:\somedirectory") then
             'do something
             'do something else
  End If
End Sub

I will only tell you how to do it, not do it for you.------------
Unless, of course, you want to hire me to do work for you.---
^^Thats my signature--------------------------------------
http://www.catb.org/~esr/faqs/smart-questions.html -------
^^Took that from planoie's profile--------------------------
Old January 12th, 2007, 07:32 PM
Friend of Wrox
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts

Hey there, d.

That was an amusing (and right-on-the-money) link. The details about what not to do are exactly the things that have frustrated me reading posts here (and in similar fora I participate in).

I remember a few months ago when someone took umbrage at your signature. It’s sad that you have to add that label you add to prevent that...

I didn't wind up using Earl’s suggestion. I would have to go back and look, but I think I used the System.IO.Directory class, as you suggested here. It was Earl’s suggestion though that moved me along toward the answer.

Similar Threads
Thread Thread Starter Forum Replies Last Post
What’s the .NET Way to test if Folder Exists? BrianWren Pro Visual Basic 2005 3 March 14th, 2007 08:35 AM
What’s the .NET Way to test if Folder Exists? BrianWren VB.NET 0 November 30th, 2006 02:46 PM
How to test if a column exists in a table jtrifts SQL Server 2000 2 February 16th, 2006 02:25 PM
howto test document exists folklayer XSLT 2 October 19th, 2005 05:56 PM
Test to see if a SQL Server exists Mitch Access 2 July 18th, 2003 04:29 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.