读取文本文件内容的问题,很菜的

If Not File.Exists("c:\test.txt") Then
Console.WriteLine("{0} does not exist.", "c:\test.txt")
Return
End If
Dim sr As StreamReader = File.OpenText("c:\test.txt")
Dim input As String
input = sr.ReadLine()
'While Not input Is Nothing
Do
Console.WriteLine(input)
input = sr.ReadLine()
TextBox1.Text = TextBox1.Text & input
'End While
Loop Until input Is Nothing
Console.WriteLine("The end of the stream has been reached.")
sr.Close()

我想读取文本文件里的两部内容,这段哪里有错啊,(全部内容共两行)。Textbox控件赋值是最后一行的内容,怎么才能把第一行的内容也读出来啊。望指教
[622 byte] By [aaa111111-aaa111111] at [2008-2-12]
# 1
ReadLine()就是一行 一行读的
有个 readtoend 吧
查Msdn
# 2
你用 listbox 试试。
vzxq-灵感人 at 2007-11-1 > top of Msdn China Tech,.NET技术,ASP.NET...
# 3
If Not File.Exists("c:\test.txt") Then
Console.WriteLine("{0} does not exist.", "c:\test.txt")
Return
End If
Dim sr As StreamReader = File.OpenText("c:\test.txt")
Dim input As String
input = sr.ReadLine()
'While Not input Is Nothing
Do

Console.WriteLine(input)
TextBox1.Text = TextBox1.Text & input
input = sr.ReadLine()

'End While
Loop Until input Is Nothing
Console.WriteLine("The end of the stream has been reached.")
sr.Close()

改动TextBox1.Text = TextBox1.Text & input的位置,你原来的程序中,掉了在循环外面读的一行.
chengsion at 2007-11-1 > top of Msdn China Tech,.NET技术,ASP.NET...