C#DOTNETCONSOLEAPPLICATION

File using Isolated Storage

Form Design


Source Code


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.IO.IsolatedStorage;
namespace file_iso
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{ IsolatedStorageFile fs = IsolatedStorageFile.GetMachineStoreForDomain();
IsolatedStorageFileStream Is = new IsolatedStorageFileStream(@"//note.txt", FileMode.Create, fs);
StreamWriter sw = new StreamWriter(Is);
sw.Write(textBox1.Text);
sw.Flush();
sw.Close();

}
private void button2_Click(object sender, EventArgs e)
{
IsolatedStorageFile fs = IsolatedStorageFile.GetMachineStoreForDomain();
IsolatedStorageFileStream Is = new IsolatedStorageFileStream(@"//note.txt", FileMode.Open, fs);
StreamReader sw = new StreamReader(Is);
textBox2.Text=sw.ReadToEnd();
sw.Close();
}
}
}

Output Screen



No comments:

Post a Comment

Techzmatrix