When i try to do this:
folderPicker = new FolderPicker();
folderPicker.SuggestedStartLocation = PickerLocationId.Desktop;
folderPicker.FileTypeFilter.Add(".txt");
StorageFolder folder = await folderPicker.PickSingleFolderAsync();
it show me error:
Error 2 The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'. C:\Users\Lukasz\Documents\Visual Studio 2012\Projects\RobimyProjekt\RobimyProjekt\ImageBrowser.xaml.cs.
When i deleted "await" it show me another error:
Error 2 Cannot implicitly convert type 'Windows.Foundation.IAsyncOperation' to 'Windows.Storage.StorageFolder' C:\Users\Lukasz\Documents\Visual Studio 2012\Projects\RobimyProjekt\RobimyProjekt\ImageBrowser.xaml.cs 61 36 RobimyProjekt.
What's going on? That code is from msdna and i using Visual Studio 2012.
The below worked for me. It took me a few days to figure this out; but, for my own learning project, I wanted to see if I could make a Folder, File, and then read from it. I was, just, able to create my folder in my designated path by doing the below.
Granted, I am passing a Textbox object as a parameter; but, disregarding that, the following works for me when I try and create my folder using a
FolderPicker
and aStorageFolder
.