[英]how to write to .txt file in UWP vb.net
我试图有一个.txt文件,其中包含一行并带有数字。 我需要此txt文件由程序进行编辑并与之一起安装。 需要替换数字时,.txt文件将被完全覆盖。
我怎样才能做到这一点? 所有其他教程都引用C#或JS,我需要vb.NET
阅读此创建,编写和阅读文件主题,了解如何与UWP
的文件交互。
要将字符串写入StorageFile
使用FileIO.WriteTextAsync
或FileIO.AppendTextAsync
函数
Dim file As StorageFile = Await ApplicationData.Current.LocalFolder.CreateFileAsync("file.txt", CreationCollisionOption.ReplaceExisting)
Dim strData As String = "sample text to write"
Await FileIO.WriteTextAsync(file, strData)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.