Code: Writing Text to a File (Visual Basic),CodeWri,odeWrit,deWriti,eWritin,Writing,WritingT,ritingTe,itingTex,tingText,ingTextt,ngTextto,gTexttoa,TexttoaF,exttoaFi,xttoaFil,ttoaFile,toaFileV,oaFileVi,aFileVis,FileVisu,ileVisua,leVisual,eVisualB,VisualBa,isualBas,sualBasi

本站地址:http://www.bajiao123.com

Code: Writing Text to a File (Visual Basic)
This example writes a string to a text file using the WriteLine method of the StreamWriter class.
Dim file As New System.IO.StreamWriter("c:\test.txt")
file.WriteLine("Here is the first line.")
file.Close()Compiling the Code
This example requires:
The following conditions may cause an exception:
This example creates a new file, if the file does not already exist. If an application needs to create a file, that application needs Create access for the folder (see Access Control). If the file already exists, the application needs only Write access, a lesser privilege. Where possible, it is more secure to create the file during deployment, and only grant Read access to a single file, rather than Create access for a folder.
本站地址:http://www.bajiao123.com

