隔离存储 - windowsphone

时间:2014-09-06 22:41:09

标签: vb.net visual-studio-2012 windows-phone-8 isolatedstorage

如何在Windows Phone上的隔离存储中创建,读取,写入,删除文件和目录?(VB.Net)(Visual Studio 2012)


我使用此代码 但我看到一些错误。

创建文件:

Dim sw As New StreamWriter(New IsolatedStorageFileStream("FirstRun\a.txt", FileMode.Create, file))
sw.WriteLine(Textbox1.text)

阅读表单隔离存储:

Dim file As IsolatedStorageFile = IsolatedStorageFile.GetUserStoreForApplication()
file.CreateDirectory("UserTexts")
Dim sw As New StreamReader(New IsolatedStorageFileStream("UserTexts\user.txt", FileMode.Open, file))

读取文件:

TXTBlock.Text = sw.ReadToEnd()
sw.Close()

删除文件:

Dim file As IsolatedStorageFile = IsolatedStorageFile.GetUserStoreForApplication()
file.DeleteFile("Temp\a.farsmob")

删除文件夹:

file.DeleteDirectory("Temp")

创建文件夹:

Dim file As IsolatedStorageFile = IsolatedStorageFile.GetUserStoreForApplication()
file.CreateDirectory("FirstRun")

1 个答案:

答案 0 :(得分:0)

请参阅此链接以获取隔离存储空间。这对于隔离存储初学者来说是最好的..

Isolated Storage