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.
Code: Writing Text to a File (Visual Basic)-.NET教程,VB.Net语言
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » Code: Writing Text to a File (Visual Basic)-.NET教程,VB.Net语言
相关推荐
-      VS2010的aspx文件中的html代码的格式化方法
-      .net 反序题目的详细解答第1/2页
-      asp.net创建html文本文件实例
-      比较完整的 asp.net 学习流程
-      C# XML操作 代码大全(读XML,写XML,更新,删除节点,与dataset结合等)第1/2页
-      官网 Ext direct包中.NET版的问题
-      c# 连接字符串数据库服务器端口号 .net状态服务器端口号
-      asp.net教程:简单的C#图片上传代码或C#文件上传代码