如果第二行出现在TextBox1中,则逐行查看TextBox1中RichTextBox的每一行,第一行将消失

时间:2019-01-18 13:03:18

标签: vb.net

我想在5秒钟后显示从richtextbox1到textbox1的第一行,将清除textbox1,并显示从richtextbox1的第二行到textbox1

我想展示输出

(while reading XRef): Error: Invalid XRef stream XRefParseException

 data: 'An error occurred while parsing the PDF: InvalidPDFException',

我该怎么做才能获得像这样的输出。

预先感谢

实际上我尝试过,但是它显示了RichTextbox中的每一行

我需要从Richtextbox到Textbox1的第一行5秒钟,之后它将消失,第二行将出现在TextBox1上

green
...after 5 sec   //green will be cleared from Textbox1 and write Yellow
yellow
...after 5 sec   //Yellow will be cleared from Textbox1 and write blue
blue
...after 5 sec   //blue will be cleared from Textbox1 and write red
red

结束子

我想在TextBox1中显示输出

Private Sub Timer1_Tick_1(sender As Object, e As EventArgs) Handles Timer1.Tick

   For Each strLine As String In RichTextBox2.Text.Split()

       txt_myip.Text = strLine.Remove(0, 1)

   Next

我该怎么做才能获得像这样的输出。

预先感谢

1 个答案:

答案 0 :(得分:0)

您应该使用计时器,将时间间隔设置为5000毫秒(即5秒),然后在Timer_Tick事件下输入此代码

'Declare a variable for storing the current index
Dim index As Integer = 0
Private Sub Timer1_Tick_1(sender As Object, e As EventArgs) Handles Timer1.Tick
    If (Not index >= RichTextBox2.Lines.Length- 1) Then
        txt_myip.Text = RichTextBox2.Lines(index)
        index += 1
    Else 
        index = 0
        Timer1.Stop()
    End If
End Sub