阅读全文
http://www.cckan.net/forum.php?mod=viewthread&tid=38&extra=page%3D1
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace 读取文件和写入文件
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
StreamWriter sfile = new StreamWriter("j://sufei.txt");//写入到sufei.txt文件中
sfile.Write("sufeisufei");
sfile.Close();
StreamReader ss = new StreamReader("j://sufei.txt");//读取文件sufei.txt中的内容
this.richTextBox1.Text = ss.ReadLine();
ss.Close();
}
}
}