J
james
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
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