请协助我进行VB光盘写入。 [英] Please assist me in VB disc write.
问题描述
我需要你的帮助,我有大量的数据,不知道怎么把它写到硬盘上。
I need your help, I have tons of data and do not know how to write it to a hard drive.
VS 2017 - 社区:Visual Basic
VS 2017 - Community: Visual Basic
文档说明为" My.Computer.FileSystem.WriteAllText ( " C:\ TestFolder1 \ test.txt" ,
< span style ="">"这是要添加的新文本。" , True )"
The documentation says to "My.Computer.FileSystem.WriteAllText("C:\TestFolder1\test.txt",
"This is new text to be added.",True)"
但我只有"My.InternalXMLHelper"
but I only have "My.InternalXMLHelper"
我的VB没有"My.Computer"任何事情。
My VB does not have "My.Computer" anything.
我正在使用"ConsoleApp.sln - 我需要一个不同的基础吗?"
I am using "ConsoleApp.sln -- do I need a different foundation?
谢谢,
Dave
推荐答案
我需要你的帮助,我有大量的数据,不知道怎么把它写到硬盘上。
I need your help, I have tons of data and do not know how to write it to a hard drive.
VS 2017 - 社区:Visual Basic
VS 2017 - Community: Visual Basic
文档说" My.Computer.FileSystem.WriteAllText( " C:\ TestSolder1 \ test.txt" ,
"这是要添加的新文字。" , 真 )"
The documentation says to "My.Computer.FileSystem.WriteAllText("C:\TestFolder1\test.txt",
"This is new text to be added.",True)"
但我只有"My.InternalXMLHelper"
but I only have "My.InternalXMLHelper"
我的VB没有"My.Computer"任何事情。
My VB does not have "My.Computer" anything.
我正在使用"ConsoleApp.sln - 我需要一个不同的基础吗?"
I am using "ConsoleApp.sln -- do I need a different foundation?
谢谢,
Dave
您好
根据您的需要,有多种不同的方式来处理加载/保存数据。
There are MANY different ways to deal with loading/saving data depending on your needs.
以下是显示2种方法的示例。 (如果您想尝试此示例,请注释掉一个或另一个)这是在Windows窗体项目中。
Here is an example showing 2 methods. (comment out one or the other if you want to try this example out) This is in a Windows Form Project.
Option Strict On
Option Explicit On
Public Class Form1
' defining the path here allows it
' to be used in several places. Adjust
' it to suit your needs.
Dim myPath As String = My.Computer.FileSystem.SpecialDirectories.Desktop & "\TestFile.txt"
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
My.Computer.FileSystem.WriteAllText(myPath, "This is new text to be added.", True)
' OR for saving a series of whole lines
' (say) in a collection such as an
' array of strings etc
IO.File.WriteAllLines(myPath, {"This is the first line.", "SecondLine"})
End Sub
End Class
这篇关于请协助我进行VB光盘写入。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!