Skip to content

Commit f9191d3

Browse files
committed
remove vb and js code
1 parent 6e99232 commit f9191d3

8 files changed

Lines changed: 8 additions & 186 deletions

hub/apps/develop/files/create-read-write-files.md

Lines changed: 1 addition & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ ms.localizationpriority: medium
99
dev_langs:
1010
- csharp
1111
- cppwinrt
12-
- cpp
13-
- vb
1412
---
1513
# Create, write, and read a file
1614

@@ -29,7 +27,7 @@ Read and write a file using a [StorageFile](/uwp/api/windows.storage.storagefile
2927

3028
- **Understand async programming for WinUI apps**
3129

32-
You can learn how to write asynchronous apps in C# or Visual Basic, see [Call asynchronous APIs in C# or Visual Basic](/windows/uwp/threading-async/call-asynchronous-apis-in-csharp-or-visual-basic). To learn how to write asynchronous apps in C++/WinRT, see [Concurrency and asynchronous operations with C++/WinRT](/windows/uwp/cpp-and-winrt-apis/concurrency).
30+
You can learn how to write asynchronous apps in C#, see [Call asynchronous APIs in C# or Visual Basic](/windows/uwp/threading-async/call-asynchronous-apis-in-csharp-or-visual-basic). To learn how to write asynchronous apps in C++/WinRT, see [Concurrency and asynchronous operations with C++/WinRT](/windows/uwp/cpp-and-winrt-apis/concurrency).
3331

3432
- **Know how to get the file that you want to read from, write to, or both**
3533

@@ -60,11 +58,6 @@ Windows::Foundation::IAsyncAction ExampleCoroutineAsync()
6058
}
6159
```
6260

63-
```vb
64-
' Create sample file; replace if exists.
65-
Dim storageFolder As StorageFolder = Windows.Storage.ApplicationData.Current.LocalFolder
66-
Dim sampleFile As StorageFile = Await storageFolder.CreateFileAsync("sample.txt", CreationCollisionOption.ReplaceExisting)
67-
```
6861

6962
## Writing to a file
7063

@@ -89,10 +82,6 @@ Windows::Foundation::IAsyncAction ExampleCoroutineAsync()
8982
}
9083
```
9184

92-
```vb
93-
Dim storageFolder As StorageFolder = Windows.Storage.ApplicationData.Current.LocalFolder
94-
Dim sampleFile As StorageFile = Await storageFolder.GetFileAsync("sample.txt")
95-
```
9685

9786
**Writing text to a file**
9887

@@ -115,9 +104,6 @@ Windows::Foundation::IAsyncAction ExampleCoroutineAsync()
115104
}
116105
```
117106

118-
```vb
119-
Await Windows.Storage.FileIO.WriteTextAsync(sampleFile, "Swift as a shadow")
120-
```
121107

122108
**Writing bytes to a file by using a buffer (2 steps)**
123109

@@ -147,11 +133,6 @@ Await Windows.Storage.FileIO.WriteTextAsync(sampleFile, "Swift as a shadow")
147133
```
148134

149135

150-
```vb
151-
Dim buffer = Windows.Security.Cryptography.CryptographicBuffer.ConvertStringToBinary(
152-
"What fools these mortals be",
153-
Windows.Security.Cryptography.BinaryStringEncoding.Utf8)
154-
```
155136

156137
2. Then write the bytes from your buffer to your file by calling the [FileIO.WriteBufferAsync](/uwp/api/windows.storage.fileio.writebufferasync) method.
157138

@@ -164,9 +145,6 @@ Await Windows.Storage.FileIO.WriteTextAsync(sampleFile, "Swift as a shadow")
164145
```
165146

166147

167-
```vb
168-
Await Windows.Storage.FileIO.WriteBufferAsync(sampleFile, buffer)
169-
```
170148

171149
**Writing text to a file by using a stream (4 steps)**
172150

@@ -191,9 +169,6 @@ Await Windows.Storage.FileIO.WriteTextAsync(sampleFile, "Swift as a shadow")
191169
```
192170

193171

194-
```vb
195-
Dim stream = Await sampleFile.OpenAsync(Windows.Storage.FileAccessMode.ReadWrite)
196-
```
197172

198173
2. Next, get an output stream by calling the [IRandomAccessStream.GetOutputStreamAt](/uwp/api/windows.storage.streams.irandomaccessstream.getoutputstreamat) method from the `stream`. If you're using C#, then enclose this in a using statement to manage the output stream's lifetime. If you're using [C++/WinRT](/windows/uwp/cpp-and-winrt-apis/intro-to-using-cpp-with-winrt), then you can control its lifetime by enclosing it in a block, or setting it to `nullptr` when you're done with it.
199174

@@ -211,11 +186,6 @@ Await Windows.Storage.FileIO.WriteTextAsync(sampleFile, "Swift as a shadow")
211186
```
212187

213188

214-
```vb
215-
Using outputStream = stream.GetOutputStreamAt(0)
216-
' We'll add more code here in the next step.
217-
End Using
218-
```
219189

220190
3. Now add this code (if you're using C#, within the existing using statement) to write to the output stream by creating a new [DataWriter](/uwp/api/windows.storage.streams.datawriter) object and calling the [DataWriter.WriteString](/uwp/api/windows.storage.streams.datawriter.writestring) method.
221191

@@ -233,10 +203,6 @@ Await Windows.Storage.FileIO.WriteTextAsync(sampleFile, "Swift as a shadow")
233203
```
234204

235205

236-
```vb
237-
Dim dataWriter As New DataWriter(outputStream)
238-
dataWriter.WriteString("DataWriter has methods to write to various types, such as DataTimeOffset.")
239-
```
240206

241207
4. Lastly, add this code (if you're using C#, within the inner using statement) to save the text to your file with [DataWriter.StoreAsync](/uwp/api/windows.storage.streams.datawriter.storeasync) and close the stream with [IOutputStream.FlushAsync](/uwp/api/windows.storage.streams.ioutputstream.flushasync).
242208

@@ -251,10 +217,6 @@ Await Windows.Storage.FileIO.WriteTextAsync(sampleFile, "Swift as a shadow")
251217
```
252218

253219

254-
```vb
255-
Await dataWriter.StoreAsync()
256-
Await outputStream.FlushAsync()
257-
```
258220

259221
**Best practices for writing to a file**
260222

@@ -277,10 +239,6 @@ auto sampleFile{ co_await storageFolder.GetFileAsync(L"sample.txt") };
277239
// Process file
278240
```
279241

280-
```vb
281-
Dim storageFolder As StorageFolder = Windows.Storage.ApplicationData.Current.LocalFolder
282-
Dim sampleFile As StorageFile = Await storageFolder.GetFileAsync("sample.txt")
283-
```
284242

285243
**Reading text from a file**
286244

@@ -299,9 +257,6 @@ Windows::Foundation::IAsyncOperation<winrt::hstring> ExampleCoroutineAsync()
299257
}
300258
```
301259

302-
```vb
303-
Dim text As String = Await Windows.Storage.FileIO.ReadTextAsync(sampleFile)
304-
```
305260

306261
**Reading text from a file by using a buffer (2 steps)**
307262

@@ -319,9 +274,6 @@ Dim text As String = Await Windows.Storage.FileIO.ReadTextAsync(sampleFile)
319274
```
320275

321276

322-
```vb
323-
Dim buffer = Await Windows.Storage.FileIO.ReadBufferAsync(sampleFile)
324-
```
325277

326278
2. Then use a [DataReader](/uwp/api/windows.storage.streams.datareader) object to read first the length of the buffer and then its contents.
327279

@@ -338,10 +290,6 @@ Dim text As String = Await Windows.Storage.FileIO.ReadTextAsync(sampleFile)
338290
```
339291

340292

341-
```vb
342-
Dim dataReader As DataReader = Windows.Storage.Streams.DataReader.FromBuffer(buffer)
343-
Dim text As String = dataReader.ReadString(buffer.Length)
344-
```
345293

346294
**Reading text from a file by using a stream (4 steps)**
347295

@@ -359,9 +307,6 @@ Dim text As String = Await Windows.Storage.FileIO.ReadTextAsync(sampleFile)
359307
```
360308

361309

362-
```vb
363-
Dim stream = Await sampleFile.OpenAsync(Windows.Storage.FileAccessMode.Read)
364-
```
365310

366311
2. Get the size of the stream to use later.
367312

@@ -375,9 +320,6 @@ Dim text As String = Await Windows.Storage.FileIO.ReadTextAsync(sampleFile)
375320
```
376321

377322

378-
```vb
379-
Dim size = stream.Size
380-
```
381323

382324
3. Get an input stream by calling the [IRandomAccessStream.GetInputStreamAt](/uwp/api/windows.storage.streams.irandomaccessstream.getinputstreamat) method. Put this in a using statement to manage the stream's lifetime. Specify 0 when you call GetInputStreamAt to set the position to the beginning of the stream.
383325

@@ -395,11 +337,6 @@ Dim text As String = Await Windows.Storage.FileIO.ReadTextAsync(sampleFile)
395337
```
396338

397339

398-
```vb
399-
Using inputStream = stream.GetInputStreamAt(0)
400-
' We'll add more code here in the next step.
401-
End Using
402-
```
403340

404341
4. Lastly, add this code within the existing using statement to get a [DataReader](/uwp/api/windows.storage.streams.datareader) object on the stream then read the text by calling [DataReader.LoadAsync](/uwp/api/windows.storage.streams.datareader.loadasync) and [DataReader.ReadString](/uwp/api/windows.storage.streams.datareader.readstring).
405342

@@ -417,11 +354,6 @@ Dim text As String = Await Windows.Storage.FileIO.ReadTextAsync(sampleFile)
417354
```
418355

419356

420-
```vb
421-
Dim dataReader As New DataReader(inputStream)
422-
Dim numBytesLoaded As UInteger = Await dataReader.LoadAsync(CUInt(size))
423-
Dim text As String = dataReader.ReadString(numBytesLoaded)
424-
```
425357

426358
## See also
427359

hub/apps/develop/files/determine-availability-microsoft-onedrive-files.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Determine if a Microsoft OneDrive file is available using the [StorageFile.IsAva
2222

2323
- **Understand async programming for WinUI apps**
2424

25-
You can learn how to write asynchronous apps in C# or Visual Basic, see [Call asynchronous APIs in C# or Visual Basic](/windows/uwp/threading-async/call-asynchronous-apis-in-csharp-or-visual-basic). To learn how to write asynchronous apps in C++, see [Asynchronous programming in C++](/windows/uwp/threading-async/asynchronous-programming-in-cpp-universal-windows-platform-apps).
25+
You can learn how to write asynchronous apps in C#, see [Call asynchronous APIs in C# or Visual Basic](/windows/uwp/threading-async/call-asynchronous-apis-in-csharp-or-visual-basic). To learn how to write asynchronous apps in C++, see [Asynchronous programming in C++](/windows/uwp/threading-async/asynchronous-programming-in-cpp-universal-windows-platform-apps).
2626

2727
- **App capability declarations**
2828

hub/apps/develop/files/fast-file-properties.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Learn how to quickly gather a list of files and their properties from a library
1212

1313
Prerequisites 
1414
- **Asynchronous programming for WinUI apps**  
15-
You can learn how to write asynchronous apps in C# or Visual Basic, see [Call asynchronous APIs in C# or Visual Basic](/windows/uwp/threading-async/call-asynchronous-apis-in-csharp-or-visual-basic). To learn how to write asynchronous apps in C++, see [Asynchronous programming in C++](/windows/uwp/threading-async/asynchronous-programming-in-cpp-universal-windows-platform-apps)
15+
You can learn how to write asynchronous apps in C#, see [Call asynchronous APIs in C# or Visual Basic](/windows/uwp/threading-async/call-asynchronous-apis-in-csharp-or-visual-basic). To learn how to write asynchronous apps in C++, see [Asynchronous programming in C++](/windows/uwp/threading-async/asynchronous-programming-in-cpp-universal-windows-platform-apps)
1616
- **Access permissions to Libraries**  
1717
The code in these examples requires the picturesLibrary capability, but your file location may require a different capability, or no capability at all. To learn more, see [File access permissions](./file-access-permissions.md)
1818
- **Simple file enumeration**   

hub/apps/develop/files/file-access-permissions.md

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ ms.localizationpriority: medium
99
dev_langs:
1010
- csharp
1111
- cppwinrt
12-
- cpp
13-
- javascript
1412
---
1513

1614
# File access permissions
@@ -33,9 +31,6 @@ There are two primary ways to access files and folders in your app's install dir
3331
Windows.Storage.StorageFolder installedLocation = Windows.ApplicationModel.Package.Current.InstalledLocation;
3432
```
3533

36-
```javascript
37-
var installDirectory = Windows.ApplicationModel.Package.current.installedLocation;
38-
```
3934

4035
```cppwinrt
4136
#include <winrt/Windows.Storage.h>
@@ -53,13 +48,6 @@ There are two primary ways to access files and folders in your app's install dir
5348
StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///file.txt"));
5449
```
5550

56-
```javascript
57-
Windows.Storage.StorageFile.getFileFromApplicationUriAsync("ms-appx:///file.txt").done(
58-
function(file) {
59-
// Process file
60-
}
61-
);
62-
```
6351

6452
```cppwinrt
6553
Windows::Foundation::IAsyncAction ExampleCoroutineAsync()
@@ -95,9 +83,6 @@ There are two primary ways to access files and folders from your app's data loca
9583
StorageFolder localFolder = ApplicationData.Current.LocalFolder;
9684
```
9785

98-
```javascript
99-
var localFolder = Windows.Storage.ApplicationData.current.localFolder;
100-
```
10186

10287
```cppwinrt
10388
Windows::Storage::StorageFolder storageFolder{
@@ -117,13 +102,6 @@ There are two primary ways to access files and folders from your app's data loca
117102
StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appdata:///local/file.txt"));
118103
```
119104

120-
```javascript
121-
Windows.Storage.StorageFile.getFileFromApplicationUriAsync("ms-appdata:///local/file.txt").done(
122-
function(file) {
123-
// Process file
124-
}
125-
);
126-
```
127105

128106
```cppwinrt
129107
Windows::Storage::StorageFile file{
@@ -163,13 +141,6 @@ By default, your app can only access files and folders in the user's Downloads f
163141
StorageFile newFile = await DownloadsFolder.CreateFileAsync("file.txt");
164142
```
165143

166-
```javascript
167-
Windows.Storage.DownloadsFolder.createFileAsync("file.txt").done(
168-
function(newFile) {
169-
// Process file
170-
}
171-
);
172-
```
173144

174145
```cppwinrt
175146
Windows::Storage::StorageFile newFile{
@@ -188,13 +159,6 @@ By default, your app can only access files and folders in the user's Downloads f
188159
StorageFolder newFolder = await DownloadsFolder.CreateFolderAsync("New Folder");
189160
```
190161

191-
```javascript
192-
Windows.Storage.DownloadsFolder.createFolderAsync("New Folder").done(
193-
function(newFolder) {
194-
// Process folder
195-
}
196-
);
197-
```
198162

199163
```cppwinrt
200164
Windows::Storage::StorageFolder newFolder{

hub/apps/develop/files/file-properties.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Get properties—top-level, basic, and extended—for a file represented by a [S
2424

2525
- **Understand async programming for WinUI apps**
2626

27-
You can learn how to write asynchronous apps in C# or Visual Basic, see [Call asynchronous APIs in C# or Visual Basic](/windows/uwp/threading-async/call-asynchronous-apis-in-csharp-or-visual-basic). To learn how to write asynchronous apps in C++, see [Asynchronous programming in C++](/windows/uwp/threading-async/asynchronous-programming-in-cpp-universal-windows-platform-apps).
27+
You can learn how to write asynchronous apps in C#, see [Call asynchronous APIs in C# or Visual Basic](/windows/uwp/threading-async/call-asynchronous-apis-in-csharp-or-visual-basic). To learn how to write asynchronous apps in C++, see [Asynchronous programming in C++](/windows/uwp/threading-async/asynchronous-programming-in-cpp-universal-windows-platform-apps).
2828

2929
- **Access permissions to the location**
3030

0 commit comments

Comments
 (0)