Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > Pro Visual Basic 2005
|
Pro Visual Basic 2005 For advanced Visual Basic coders working in version 2005. Beginning-level questions will be redirected to other forums, including Beginning VB 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro Visual Basic 2005 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:46 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?

Please see http://p2p.wrox.com/topic.asp?TOPIC_ID=53030
 
Old March 13th, 2007, 11:10 AM
Registered User
 
Join Date: Mar 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try

Imports System.Io
_____

        Dim d As Directory
        If d.Exists("c:\windows") = True Then
            MsgBox("Directory Exists!")
        Else
            MsgBox("Directory not found!")
        End If

gives a couple of warnings, but you should be able to get around these.

 
Old March 13th, 2007, 04:56 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

I wound up using:
Code:
Imports Microsoft.VisualBasic.FileIO.FileSystem

Class . . .

    Sub . . . ()

        If DirectoryExists("<Path>") = True Then
            . . . .
 
Old March 14th, 2007, 08:35 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 839
Thanks: 0
Thanked 1 Time in 1 Post
Default

There is a shared method on the Directory class, as:

    If Directory.Exists(path) Then
    ...

Jeff Mason
Custom Apps, Inc.
je.mason@comcast.net





Similar Threads
Thread Thread Starter Forum Replies Last Post
What’s the .NET Way to test if Folder Exists? BrianWren Visual Basic 2005 Basics 3 January 12th, 2007 07:32 PM
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.