欢迎光临
我们一直在努力

Writing Text to a File (Visual Basic)-.NET教程,VB.Net语言

建站超值云服务器,限时71元/月

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.

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » Writing Text to a File (Visual Basic)-.NET教程,VB.Net语言
分享到: 更多 (0)