using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using System.IO;
using System.Runtime.InteropServices;
namespace WindowsApplication4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
open();
}
private void save()
{
using (FileStream aFile = new FileStream( "c:/temp.txt ", FileMode.Create))
{
using (StreamWriter sw = new StreamWriter(aFile))
{
sw.Write(this.textBox1.Text);
}
}
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
save();
}
private void open()
{
using (StreamReader reader = new StreamReader( "c:/temp.txt ", System.Text.Encoding.GetEncoding( "GB2312 ")))
{
textBox1.Clear();
textBox1.Text = reader.ReadToEnd();