c#字符串分割问题! 如何将文本的内容按行循环输出?实现输出第一行,之后清空又输出第二行,在清空输出

c#字符串分割问题!
如何将文本的内容按行循环输出?实现输出第一行,之后清空又输出第二行,在清空输出第三行,直到循环将文本的行数全部输出后关闭程序!
控制台窗口就行,谢谢各位帮帮我,好么?
能解释一下思路么?还有代码写全点谢谢

第1个回答  2012-07-10
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace ConsoleApplication30
{
class Program
{
static void Main(string[] args)
{
string filePath = @"C:\my.txt";
FileStream fs = new FileStream(filePath, FileMode.OpenOrCreate, FileAccess.Read);
StreamReader sr = new StreamReader(fs);
string str = sr.ReadLine();
while (str != null)
{
Console.WriteLine(str);
Console.WriteLine("按键任意键输出下一行:");
Console.ReadKey();
Console.Clear();
str = sr.ReadLine();
}
Console.ReadKey();
}
}
}
第2个回答  2012-07-10
private void textBox1_TextChanged(object sender, EventArgs e)
{
textBox1.Text = "";
}
private void button1_Click(object sender, EventArgs e)
{
StreamReader sr = new StreamReader("C:\\Users\\kerry\\Desktop\\新建文本文档 (3).txt", Encoding.GetEncoding("GB2312"));
while (!sr.EndOfStream)
{
textBox1.Text = sr.ReadLine();
sr.Peek();
}
sr.Dispose();
}

内容显示的太快, 看不清楚
第3个回答  2012-07-09
private void showLines(List<string> strs)
{
foreach (string item in strs)
{
Console.WriteLine(item);
Console.ReadKey();
Console.Clear();
}
}本回答被网友采纳
第4个回答  2012-07-09
http://wenku.baidu.com/view/36094ed7c1c708a1284a446a.html

参考这个,我这里没有平台给你写代码,
相似回答