简体   繁体   中英

how to write to .txt file in UWP vb.net

i am trying to have a .txt file containing a single line with a number on it. i need this txt file to be editable by the program and to be installed with it. the .txt file will be completely overwritten when the number needs to be replaced.

how can i do this? all other tutorials refer to C# or JS I need vb.NET

Read this Create, write, and read a file topic about interaction with file in UWP .

To write string to StorageFile use FileIO.WriteTextAsync or FileIO.AppendTextAsync functions

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM