Creating a text file
Description
We can create a text file programmatically
The simple snippet shows how to create text file.
Imports System.IO
Module Module5
Sub main()
//creating file info object and naming a file
Dim f As FileInfo = New FileInfo("c:\test.txt")
//creating file stream object for file
Dim fs As FileStream = f.Create()
//listing creation time,attributes,fullname
Console.WriteLine("creation time:{0}", f.CreationTime)
Console.WriteLine("attributes :{0}", f.Attributes.ToString())
Console.WriteLine("full name:{0}", f.FullName)
End Sub
End Module
Explanation:
The file is created using create() .

How to crate a text file .just see the below code
DirectoryInfo dir = new DirectoryInfo();
if (dir.Exists == false)
dir.Create();
if (File.Exists(string path))
{
StreamWriter SW;
SW = File.AppendText();
SW.Write();
SW.Close();
}
else
{
FileStream FileUp = new FileStream(string path, FileMode, FileAccess);
StreamWriter SW = new StreamWriter(FileUp);
SW.Write();
SW.Close();
}
and also keep in data in the text files.
Regards,
prakash