private void button1_Click(object sender, EventArgs e)
{
if(fileInport.ShowDialog()==DialogResult.OK)
{
label1.Text = "";
using(FileStream fileStream= File.OpenRead(fileInport.FileName))
{
using(StreamReader streamReader=new StreamReader(fileStream))
{
string line=null;
StreamWriter streamWriter = new StreamWriter(@"c:/newtxt.txt");
while((line=streamReader.ReadLine())!=null)
{
//string[] strs=line.Split(' ');
label1.Text += line + "/n";
streamWriter.WriteLine(line);
}
streamWriter.Dispose();
}
}
}
}
数据导入导出操作
最新推荐文章于 2024-01-09 21:40:36 发布