读取记事本的值
能不能点一下按钮读取一行 写出
Private Sub Read()
Dim sr As System.IO.StreamReader
Dim input As String = " "
Dim i As Integer = 0
sr = System.IO.File.OpenText( "c:\inetpub\wwwroot\T\ok.txt ")
While sr.Peek() <> -1
input = sr.ReadLine
ReDim Preserve arr(i)
arr(i) = input
i = i + 1
End While
End Sub
这是我把每一行放进一个数组中的函数
------解决方案--------------------有个 ReadLine() 方法可以读取一行
------解决方案--------------------using (StreamReader sr = System.IO.File.OpenText( "c:\inetpub\wwwroot\T\ok.txt "))
{
string s = " ";
while ((s = sr.ReadLine()) != null)
{
//s放入你的数组
}
}
------解决方案--------------------@ "c:\inetpub\wwwroot\T\ok.txt "
------解决方案--------------------先按行读进来,再点一下显示一行。