当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > Code: Writing Text to a File (Visual Basic)

ASP.NET
Check Your Internet Connection With C#
Essential .NET读书笔记
可用来显示空值的时间选择控件3
学习Keny boy sps区域列表的管理入口程序
[译]Visual Basic 2005在语言上的增强(十)应用程序级别事件
什么时候应该使用 ==?什么时候应该使用 Equals?
“String.Equals(string)”和“==”那个快?
应用ADO.net得到系统表信息
不会被其他窗体遮挡的抓图,使用API的PrintWindow函数
关于.net下服务安装
水晶报表4.6的使用示例
超大正整数加法与乘法最笨方法实现
实现web页面的局部刷新
动态生成带事件的MsFlexGrid
一些codedom的资料。
WML教程3:任务与导航-赋值与数据交换
WML教程7:WML的事件
WML教程10:分组选择控件(Optgroup)和复杂实例
WML教程5:任务和任务屏蔽
VS.NET安装部署深入研究

ASP.NET 中的 Code: Writing Text to a File (Visual Basic)


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 77 ::
收藏到网摘: n/a


This example writes a string to a text file using the WriteLine method of the StreamWriter class.ExampleDim 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.