2013-05-26 35 views
1

好的,所以我試圖讓我的程序讀取文本文件的特定行。我創建了兩個標籤,一個是TheFileName,另一個是TheText。一切正常,除非我無法弄清楚如何讓它讀取第二行,而只讀第二行。我不能讓我的程序讀取文本文件的第二行

代碼:

昏暗RLO作爲新IO.StreamReader( 「C:\用戶\亞歷克斯\文檔\的Visual Studio 2012 \項目\ RobloxRecruitV1 \ RobloxRecruitV1 \ BIN \調試\」 & TheFileName.Text &」。 TXT「)

TheText.Text = Rlo.ReadLine(2)

+0

我想這是VB.NET和不VB6? – rene

回答

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() 
+0

非常感謝。 – user2422403

相關問題