W
winn
I have extracted the following code from
http://msdn.microsoft.com/library/d...html/frlrfsystemiodirectoryinfoclasstopic.asp
I am new to .net and I was simply wondering how to use this code in vb,
i.e. to where exactly do I paste this code. Normally we have Form_Load
rather than Main ?
Imports System
Imports System.IO
Public Class Test
Public Shared Sub Main()
' Specify the directories you want to manipulate.
Dim di As DirectoryInfo = New DirectoryInfo("c:\MyDir")
Try
' Determine whether the directory exists.
If di.Exists Then
' Indicate that it already exists.
Console.WriteLine("That path exists already.")
Return
End If
Catch e As Exception
Console.WriteLine("The process failed: {0}", e.ToString())
End Try
End Sub
End Class
http://msdn.microsoft.com/library/d...html/frlrfsystemiodirectoryinfoclasstopic.asp
I am new to .net and I was simply wondering how to use this code in vb,
i.e. to where exactly do I paste this code. Normally we have Form_Load
rather than Main ?
Imports System
Imports System.IO
Public Class Test
Public Shared Sub Main()
' Specify the directories you want to manipulate.
Dim di As DirectoryInfo = New DirectoryInfo("c:\MyDir")
Try
' Determine whether the directory exists.
If di.Exists Then
' Indicate that it already exists.
Console.WriteLine("That path exists already.")
Return
End If
Catch e As Exception
Console.WriteLine("The process failed: {0}", e.ToString())
End Try
End Sub
End Class