How to check if a directory exists in VB.NET

1 Answer

0 votes
Imports System
Imports System.IO

Public Class Program
	Public Shared Sub Main(ByVal args As String())
        Dim path As String = "C:\programming\projects"

        Try

            If Directory.Exists(path) Then
                Console.WriteLine("Directory Exists")
            Else
                Console.WriteLine("Directory Not Exists")
            End If

        Catch e As Exception
            Console.WriteLine(e.Message)
        End Try
    End Sub
End Class






' run:
'
' Directory Not Exists
'

 



answered May 2, 2022 by avibootz

Related questions

2 answers 167 views
1 answer 166 views
166 views asked May 2, 2022 by avibootz
1 answer 193 views
1 answer 186 views
1 answer 200 views
...