Hi,
I need help understanding the usage of the stringbuilder class. The scenario is: i have a form set up with 2 richtextbox controls. I would like to paste lets say 40000 values in richtextbox 1 and click a button that adds a predefined string to these values and they would finally display in richtextbox2. But my code below doesn't really seem to work. It takes about an hour to perform this operation. Please help!
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Dim x As Long
Dim Mystring As New System.Text.StringBuilder()
For x = RichTextBox1.Lines.GetLowerBound(0) To RichTextBox1.Lines.GetUpperBound(0)
array1(x) = Mystring.Append("INSERT INTO #TMP (TMP) Values ('")
array1(x) = Mystring.Append(RichTextBox1.Lines(x))
array1(x) = Mystring.Append("')")
RichTextBox2.Text = array1(x).ToString() & vbCrLf
Next
End Sub
End Class
Thanks,
Bharath
I need help understanding the usage of the stringbuilder class. The scenario is: i have a form set up with 2 richtextbox controls. I would like to paste lets say 40000 values in richtextbox 1 and click a button that adds a predefined string to these values and they would finally display in richtextbox2. But my code below doesn't really seem to work. It takes about an hour to perform this operation. Please help!
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Dim x As Long
Dim Mystring As New System.Text.StringBuilder()
For x = RichTextBox1.Lines.GetLowerBound(0) To RichTextBox1.Lines.GetUpperBound(0)
array1(x) = Mystring.Append("INSERT INTO #TMP (TMP) Values ('")
array1(x) = Mystring.Append(RichTextBox1.Lines(x))
array1(x) = Mystring.Append("')")
RichTextBox2.Text = array1(x).ToString() & vbCrLf
Next
End Sub
End Class
Thanks,
Bharath