Please also take into account the suggestions from Solution 1.
Furthermore I think instead of accessing the lines of the richtextbox you should get them first something like this:
Dim textLines As List(Of String) = RichTextBox1.Lines.ToList()
and proceed your processing with
textLines
Of course you can optimize much more. You can skip the RichTextBox by implementing Paste From Clipboard directly. Also using a DataTable as data store instead of DGV can lead to improvments and is also more clean.
I hope it helps and again, please take into acount, I don't know VB.NET so pay attention with the code snippet above.
[Edit 1] Forgive me that I don't know VB.NET. Anyway I tried it with it
Takes about 15 Min for 35'000 lines (i7/ 3.4 GHz):
Private Sub ButtonProcessByRTBLines_Click(sender As Object, e As EventArgs) Handles ButtonProcessByRTBLines.Click
Dim len = RichTextBox1.Lines.Count
For i = 0 To len - 1
Dim ln = RichTextBox1.Lines(i)
If i Mod 500 = 0 Then
Label1.Text = i.ToString()
Application.DoEvents()
End If
Next
End Sub
Takes less than 0.5 seconds for 35'000 lines:
Private Sub ButtonProcessByStringList_Click(sender As Object, e As EventArgs) Handles ButtonProcessByStringList.Click
Dim textLines As List(Of String) = RichTextBox1.Lines.ToList()
Dim len = textLines.Count
For i = 0 To len - 1
Dim ln = textLines(i)
If i Mod 500 = 0 Then
Label1.Text = i.ToString()
Application.DoEvents()
End If
Next
End Sub
[Edit 2] Finally this not optimized code will be processed in less than 15 seconds. 35'000 lines on a i7/ 3.4 GHz:
Private Sub ButtonProcessToDGV_Click(sender As Object, e As EventArgs) Handles ButtonProcessToDGV.Click
Dim textLines As List(Of String) = RichTextBox1.Lines.ToList()
Dim textLinesCount = textLines.Count
With STOK_LIST
.Rows.Clear()
For x = 0 To textLinesCount - 1
Dim tx = textLines(x).ToString
If tx <> "" Then
Dim splittedLn = textLines(x).Split(vbTab)
Dim i = STOK_LIST.Rows.Add
Label1.Text = +i
.Rows(i).Cells(0).Value = splittedLn(0)
.Rows(i).Cells(1).Value = splittedLn(1)
.Rows(i).Cells(2).Value = splittedLn(2)
.Rows(i).Cells(3).Value = splittedLn(3)
.Rows(i).Cells(4).Value = splittedLn(4)
.Rows(i).Cells(5).Value = splittedLn(5)
.Rows(i).Cells(6).Value = splittedLn(6)
.Rows(i).Cells(7).Value = splittedLn(7)
.Rows(i).Cells(8).Value = splittedLn(8)
.Rows(i).Cells(9).Value = splittedLn(9)
.Rows(i).Cells(10).Value = splittedLn(10)
End If
If x Mod 500 = 0 Then
Label1.Text = x.ToString()
Application.DoEvents()
End If
Next
End With
End Sub