html5中文学习网

您的位置: 首页 > 网络编程 > ASP.NET » 正文

Code: Writing Text to a File (Visual Basic)_.NET教程_编程技术

[ ] 已经帮助:人解决问题
visual

This example writes a string to a text file using the WriteLine method of the StreamWriter class.
Example
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:
A reference to System namespace. Robust Programming
The following conditions may cause an exception:
The file exists and is read-only (IOException Class). The disk is full (IOException Class). The pathname is too long (PathTooLongException Class). Security
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.
6LDHTML5中文学习网 - HTML5先行者学习网
6LDHTML5中文学习网 - HTML5先行者学习网
(责任编辑:)
推荐书籍
推荐资讯
关于HTML5先行者 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 人才招聘 - 帮助