Problems with Replace Method

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: james (jjames700ReMoVeMe)
Date: 11/12/04


Date: Fri, 12 Nov 2004 16:17:53 -0600

Hi, I am loading a CSV file ( Comma Seperated Value) into a Richtext box. I have a routine that splits the data up when it hits
the "," and then copies the results into a listbox. The data also has some different characters in it that I am trying to
remove. The small a with two dots over it and the small y with two dots over it. Here is my code so far to remove the small y:

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

'cleans the "," character out of a comma delimited string and outputs the results to a listbox

Dim str As String = RichTextBox1.Text

Dim x As String = Chr(255) 'Chr(255)

Dim arr() As String = str.Split(","c)

'Dim arr() As String = str.Split(Chr(255), c)

For Each s As String In arr

' s = Replace(Chr(255), Chr(32),)

For Each x In s

s.Replace(x, Chr(32))

Next

ListBox1.Items.Add(s)

Next

End Sub

The problem is, when I put a Breakpoint on ListBox1.Items.Add(s), I can step into the code as it goes thru the data from the
Richtextbox and it shows the value for X as being = """" instead of the y with the two dots over it! Therefore instead of
replacing the y with a Space ( Chr(32) , it does nothing! I have checked to be sure I am using the right character code and
that part is correct. ( I tested by setting a labels text property to : Chr(255) and it displayed correctly.)

I know that I am doing something wrong , I just cannot see what it is.

Any suggestions would be greatly appreciated.

james



Relevant Pages

  • Re: How do create a formula to add IP addresses?
    ... Function NextIPAddress(IP As String) As String ... Dim Arr As Variant ... Microsoft MVP - Excel ...
    (microsoft.public.excel.misc)
  • Re: Colored Text
    ... Tried using the Richtext Box to color text. ... as long as the coloring isn't too extensive. ... to the string directly, using the Mid statement. ... As for HTML, you can certainly use that with a Web Browser ...
    (microsoft.public.vb.general.discussion)
  • Re: string manipulation
    ... What does it mean when both numbers have the same number of digits? ... The dots have no meaning,its just the way the data was entered,using the ... > Dim strAll As String ... > Dim strFirst As String ...
    (microsoft.public.access.modulesdaovba)
  • Re: string manipulation
    ... And what do the various numbers of dots mean? ... Dim strAll As String ... Dim strFirst As String ... Dim strSecond As String ...
    (microsoft.public.access.modulesdaovba)
  • Re: How do create a formula to add IP addresses?
    ... Function NextIPAddress(IP As String) As String ... Dim Arr As Variant ... NextIPAddress = Join ... Microsoft MVP - Excel ...
    (microsoft.public.excel.misc)