0

テキストボックスで指定された行を取得し、その行から文字列のテキストを取得する方法

4

2 に答える 2

3
Dim lines As String() = testing.Text.Split(Environment.NewLine)

次に、このように行にアクセスします

lines(0) // would be first line
于 2012-08-09T19:22:33.930 に答える
0

テキストボックスのテキストを行区切りに基づいて文字列の配列に分割し、十分な行がある場合は配列から行を取得する必要があります。

    Dim asLines As String()
    Dim wLineToGet As Integer = 2
    asLines = TextBox1.Text.Split(New String() {Environment.NewLine}, StringSplitOptions.None)
    If asLines IsNot Nothing AndAlso asLines.Length >= wLineToGet Then
        MessageBox.Show("Line " & wLineToGet & " = " & asLines(wLineToGet - 1))
    Else
        MessageBox.Show("There are not enough lines in the textbox to retrieve line " & wLineToGet)
    End If
于 2012-08-09T19:18:13.867 に答える