1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| using (var store = IsolatedStorageFile.GetUserStoreForApplication())
{
string directory = "C:\Documents and Settings\Dell\Bureau\Nouveau dossier";
store.CreateDirectory(directory);
string filePath = System.IO.Path.Combine(directory, "MonFichier.xml");
if (!store.FileExists(filePath))
{
IsolatedStorageFileStream File =
store.CreateFile(System.IO.Path.Combine(directory, "MonFichier ".xml")); //On créé le fichier
File.Close(); //On ferme le stream
}
using (StreamWriter sw =
new StreamWriter(store.OpenFile(filePath,
FileMode.Create, FileAccess.Write)))
{
sw.WriteLine(MaTextBox.Text);
} |
Partager