Code: Writing Text to a File (Visual Basic)

2016-01-29 12:39 1 1 收藏

Code: Writing Text to a File (Visual Basic),Code: Writing Text to a File (Visual Basic)

【 tulaoshi.com - ASP.NET 】


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.

来源:https://www.tulaoshi.com/n/20160129/1487029.html

延伸阅读
可用性设计 任何应用程序的可用性基本上由用户决定。界面设计是需多次反复的过程;在为应用程序设计界面时,第一步就设计出非常完美的界面的情况非常少见。用户参与设计过程越早,花的气力越少,创建的界面越好、越可用。 什么是好的界面 设计用户界面时,开始时最好是先看看 Microsoft 或其他公司的一些卖得很好的应用程序...
循环结构 循环结构允许重复执行一行或数行代码。Visual Basic 支持的循环结构有: 1.Do...Loop 2.For...Next 3.For Each...Next Do...Loop 用 Do 循环重复执行一语句块,且重复次数不定。Do...Loop 语句有几种演变形式,但每种都计算数值条件以决定是否继续执行。如同 If...Thencondition 必须是一个数值或...
标签: vb
从 Visual Basic 6.0 到 Visual Basic.NET 的转换(1) Microsoft Visual Basic.NET 是 Microsoft Visual Basic? 的后续版本,它是基于 .NET 框架重新设计的,您可以用它来轻松地创建用于 Microsoft Windows? 操作系统和 Web 的下一代应用程序。使用 Visual Basic.NET,可视化开发 Web 应用程序、Web 服务、Windows 应用程序和服务器端组件...
标签: vb
升级 向导 将 Currency 数据类型转换为 Decimal,因此以下代码: Dim x As Currency 升级后将变为: Dim x As Decimal Date Visual Basic 6.0 Date 变量在内部以 Double 格式存储,能够作为 Double 类型的变量操作。 Date 变量存储为 IEEE 64 位浮点数,表示从 100 年 1 月 1 日到 9999 年 12 月 31 日的日期和从 0:...
标签: vb
升级 向导 过程的 ParamArray 参数标记有升级警告。例如,以下代码: Function MyFunction(ParamArray p() As Variant) ... End Function 升级后将变为: UPGRADE_WARNING: ParamArray p was changed from ByRef to ByVal Function MyFunction(ByVal ParamArray p() As Object) ... End Function 声明中的...

经验教程

739

收藏

8

精华推荐

Visual Basic 控件数据

Visual Basic 控件数据

我叫45678

Visual Basic 控件的使用

Visual Basic 控件的使用

ADMCcai

Visual Basic .NET中操作MsAgent

Visual Basic .NET中操作MsAgent

剑茫茫剑

热门标签

微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部