【问题标题】:I can't get my program to read the second line of a text document我无法让我的程序读取文本文档的第二行
【发布时间】:2013-05-26 23:26:29
【问题描述】:

好的,所以我试图让我的程序读取文本文件的特定行。我创建了两个标签,一个指定为 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)

【问题讨论】:

  • 我认为这是 VB.NET 而不是 VB6?

标签: vb.net


【解决方案1】:
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()

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-12-27
    • 2013-04-21
    • 2016-08-03
    • 2018-05-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-16
    相关资源
    最近更新 更多