Mega Code Archive

 
Categories / VB.Net / File Directory
 

File Class Provides static methods for the creation, copying, deletion, moving, and opening of files, and aids in the creat

Imports System Imports System.IO Public Class Test     Public Shared Sub Main()         Dim path As String = "c:\temp\MyTest.txt"         If File.Exists(path) = False Then             Using sw As StreamWriter = File.CreateText(path)                 sw.WriteLine("A")                 sw.WriteLine("B")                 sw.WriteLine("C")                 sw.Flush()            End Using         End If         Using sr As StreamReader = File.OpenText(path)             Do While sr.Peek() >= 0                 Console.WriteLine(sr.ReadLine())             Loop         End Using     End Sub End Class