我正在写一个解析器,这个异常发生了。这是代码
Private Sub BackgroundWorker1_DoWork(sender As Object, e As ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
For i As Integer = 0 To TextBox1.Lines.Length - 1
If TextBox2.Lines(i).StartsWith("print") = True Then
Dim str1 As String = TextBox2.Lines(i).ToString.Replace("print", "echo")
TextBox2.Text = TextBox2.Text + Environment.NewLine + str1
ElseIf TextBox2.Lines(i) = "selfping" Then
TextBox2.Text = TextBox2.Text + Environment.NewLine + "ping 127.0.0.1"
ElseIf TextBox2.Lines(i) = "pause empty" Then
TextBox2.Text = TextBox2.Text + Environment.NewLine + "pause >nul"
ElseIf TextBox2.Lines(i) = "clear" Then
TextBox2.Text = TextBox2.Text + Environment.NewLine + "cls"
Else
TextBox2.Text = TextBox2.Text + Environment.NewLine + TextBox2.Lines(i)
End If
Next
End Sub
这适用于每一个If和ElseIf语句。
答案 0 :(得分:0)
我修好了。 Textbox2应该是textbox1。我应该得到一个代码分析器。