Clear a RichTextBox ... its not clearing Help please

vbMarkO

Centurion
Joined
Aug 19, 2005
Messages
157
I know I know ... this sounds stupid ...

But this RTB is about to drive me nuts

I have contents of an array in the rtb and I need to clear whast in the rtb so I can update it with new content but what I am getting is this

lets say I have
1
2
3
I have the above for example displayed in rtb when I update the rtb I get this
1
2
3
1
2
3
Its not clearing the other text before adding evn though I am telling it to

Her is my code
Code:
            ' Why doesnt rtbDes.text = "" get it done???????
            rtbDes.Text = ""


            For i As Integer = 0 To myPubAr.Count - 1

                rtbDes.Text = rtbDes.Text & myPubAr(i) & "..........." & myLocAr(i) & vbCrLf
            Next

I know this has got to be simple ... if I do this in lets say a listbox I can easily clear it an give it the update ... why not this stupid RTB?

ALL help very much appreciated

vbMarkO
 
Have you checked the contents of the arrays when the code executes? I can't see why it wouldn't clear the rtb - however if the array is being appended to then that could be the source of the problem.
 
You pointed the way ... it was the array ... I needed to clear it first as when I was updating it was adding the info back into the array so the rtb was clearing as it should Thanx so very much

THIS IS RESOLVED

myPuAr.CLear()
myLocAr.Clear() did the trick
Thanx
 
Back
Top