Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Folder exists in VB

Folder exists in VB

Scheduled Pinned Locked Moved Visual Basic
questionhelp
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ArchaBhandare
    wrote on last edited by
    #1

    How do I check if a folder already exists on the system without including any classes in my code? I dont know why the Try-Catch block does not work in my code. It gives compilation error that try is not excepted

    C D 2 Replies Last reply
    0
    • A ArchaBhandare

      How do I check if a folder already exists on the system without including any classes in my code? I dont know why the Try-Catch block does not work in my code. It gives compilation error that try is not excepted

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      if (System.IO.Folder.Exists(

      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

      1 Reply Last reply
      0
      • A ArchaBhandare

        How do I check if a folder already exists on the system without including any classes in my code? I dont know why the Try-Catch block does not work in my code. It gives compilation error that try is not excepted

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        First, what version of VB are you using? Second, what does you code look like?? Without that, it's really hard to tell you what you did wrong.

        Dave Kreskowiak Microsoft MVP - Visual Basic

        A 1 Reply Last reply
        0
        • D Dave Kreskowiak

          First, what version of VB are you using? Second, what does you code look like?? Without that, it's really hard to tell you what you did wrong.

          Dave Kreskowiak Microsoft MVP - Visual Basic

          A Offline
          A Offline
          ArchaBhandare
          wrote on last edited by
          #4

          Heah thanx, I got the thing working with the following piece of code Dim folderPath As String Dim fs folderPath = "C:\test" Set fs = CreateObject("Scripting.FileSystemObject") If (fs.folderexists(folderPath) <> True) Then MsgBox "Folder does not Exist" Else MsgBox "Folder Exists" End If

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups