1

好的,所以我试图让我的程序读取文本文件的特定行。我创建了两个标签,一个指定为 TheFileName,另一个指定为 TheText。一切正常,除了我不知道如何让它读取第二行,只有第二行。

代码:

Dim Rlo As New IO.StreamReader("C:\Users\Alex\Documents\Visual Studio 2012\Projects\RobloxRecruitV1\RobloxRecruitV1\bin\Debug\" & TheFileName.Text & ".txt")

TheText.Text = Rlo.ReadLine(2)

4

1 回答 1

2
Dim Rlo As New IO.StreamReader("C:\Users\Alex\Documents\Visual Studio 2012\Projects\RobloxRecruitV1\RobloxRecruitV1\bin\Debug\" & TheFileName.Text & ".txt")

Dim firstLine As String
'read first line
firstLine = Rlo.ReadLine()
'read secondline
TheText.Text = Rlo.ReadLine()
于 2013-05-26T14:10:30.090 回答