第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();
}
}本回答被网友采纳