Initializes a new instance of the DirectoryNotFoundException class with its message string set to a system-supplied message and its HRESULT set to COR_E_DIRECTORYNOTFOUND.
Assembly: mscorlib (in mscorlib.dll)
This constructor initializes the Exception.Message property of the new instance to a system-supplied message that describes the error, such as "Could not find the specified directory." This message takes into account the current system culture.
The Exception.InnerException property of the new instance is initialized to Nothing.
The following code example demonstrates how to call the DirectoryNotFoundException constructor.
Imports System.IO Module Module1 Sub Main() Try ' Specify a directory name that does not exist for this demo. Dim dir As String = "c:\78fe9lk" ' If this directory does not exist, a DirectoryNotFoundException is thrown ' when attempting to set the current directory. Directory.SetCurrentDirectory(dir) Catch ex As System.IO.DirectoryNotFoundException ' Let the user know that the directory did not exist. Console.WriteLine("Directory not found: " + ex.Message) End Try End Sub End Module
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.