Windows Dev Center

IsolatedStorageFile.CreateFile Method

Creates a file in the isolated store.

Namespace:  System.IO.IsolatedStorage
Assembly:  mscorlib (in mscorlib.dll)

'Declaration
Public Function CreateFile ( _
	path As String _
) As IsolatedStorageFileStream

Parameters

path
Type: System.String
The relative path of the file to be created in the isolated store.

Return Value

Type: System.IO.IsolatedStorage.IsolatedStorageFileStream
A new isolated storage file.

ExceptionCondition
IsolatedStorageException

The isolated store has been removed.

-or-

Isolated storage is disabled.

ArgumentException

path is malformed.

ArgumentNullException

path is Nothing.

DirectoryNotFoundException

The directory in path does not exist.

ObjectDisposedException

The isolated store has been disposed.

The following example creates files in the root of the store and in its subdirectories. This example is part of a larger example provided for IsolatedStorageFile class.


' Create a file in the root.
Dim rootFile As IsolatedStorageFileStream = _
    store.CreateFile("InTheRoot.txt")
rootFile.Close()


' Create a file in a subdirectory.
Dim subDirFile As IsolatedStorageFileStream = _
    store.CreateFile(Path.Combine(subdirectory1, "MyApp1A.txt"))
subDirFile.Close()


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2015 Microsoft