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;
namespace 对于文本的操作
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string path = "E:\\new1.txt";//建立路径的名称
string mystr = "";
FileStream fs = File.OpenRead(path);
StreamReader sr = new StreamReader(fs,Encoding.UTF8);
fs.Seek(0, SeekOrigin.Begin);
while (sr.Peek() > -1)
mystr = mystr + sr.ReadLine() + "\r\n";
sr.Close();
fs.Close();
listBox1.Items.Add(mystr);
}
}
}