最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Code: Writing Text to a File (Visual Basic)
时间:2022-07-02 11:18:34 编辑:袖梨 来源:一聚教程网
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: est.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.
Example
Dim file As New System.IO.StreamWriter("c: est.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.
相关文章
- 三国志幻想大陆2枭之歌吴国武将强度排名一览 07-08
- 崩坏星穹铁道风堇遗器搭配指南 07-08
- 黑色信标无垠叠境深层满星阵容搭配指南 07-08
- ps怎么给证件照换衣服 ps给证件照换衣服教程 07-08
- 结婚8周年纪念日说说(结婚11周年纪念日朋友圈说说怎么发) 07-08
- Astra Premium Starter Templates v4.4.29 专业模板插件 07-08