我想将用户输入数据保存到文件中这就是我所做的。解决方案执行但不创建文件

时间:2013-11-08 09:41:21

标签: xaml

private async void submit_comment(object sender,RoutedEventArgs e)         {             String input = txtInput.Text;

        //getting the DocumentsLibrary folder where a file is to be created and then creating the example.txt file 
        //and storing the StorageFile object that is returned:
        try
        {
            StorageFolder storageFolder = KnownFolders.DocumentsLibrary;
            StorageFile sampleFile = await storageFolder.GetFileAsync("sample.txt");
            //Writing to file
        await Windows.Storage.FileIO.WriteTextAsync(sampleFile, input);
        }catch(Exception)
        {

        }





    }

0 个答案:

没有答案