-1
私はこれまでにこのような質問を投稿しましたが、回答があってもコードはそれ以上に速くできませんでした。私はコードをそれまでのものに変更し、コードをスピードアップする方法のアドバイスを探しています。VB.netループでは8秒かかりますが、遅いと感じます。
私は30k行のリッチテキストボックスを持っており、各ループが30k行を含むrichtextboxの特定の行に到達すると、テキストブロックを置き換える必要があります。 (変数は、このコードで宣言されていない場合、彼らはグローバル変数であることを意味)
ここでは私のコードです:ここでは
Dim counter As Integer = 0
Dim startcount As Boolean = False
Dim holdstring As String = ""
Dim completertb4 As New StringBuilder("")
Dim completertb4one As New StringBuilder("")
MsgBox(newrtb.Lines.Count,, "")
Dim counteroflines As Integer = 1
For Each line As String In newrtb.Lines
'MsgBox(counteroflines & "----" & holdstring,, "")
If line.Contains(richtextboxl0) Then
startcount = True
holdstring = vbNewLine & richtextbox3text
ElseIf startcount = True Then
If counter = temptextbox3count Then
startcount = False
Else
counter += 1
End If
ElseIf completertb4.ToString = "" Then
holdstring = line
Else
holdstring = line
End If
If counteroflines >= 1 And counteroflines <= 10000 Then
completertb4.Append(vbNewLine & holdstring & "----" & counteroflines)
Else
completertb4one.Append(vbNewLine & holdstring & "----" & counteroflines)
End If
counteroflines += 1
Next
サンプルデータを説明したり提供したりできますか? –
私は問題を解決しました、ありがとう! –