Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Visual Basic .NET (http://www.programmingforums.org/forum19.html)
-   -   strange symbol (http://www.programmingforums.org/showthread.php?t=11182)

hush Aug 26th, 2006 11:26 AM

strange symbol
 
The following code works well apart from one slight floor. I can’t seem to figure it out.

The job it is doing it essentially removing a given section of the string by splitting it up and then joining it back together again (I’m sure the process it obvious by the code).

However when it is displayed in a text box on a form it has some wired rectangle character on the last line by itself. At first I though it was the process of splinting it and putting it back together but if I comment out the line that clears the array it seems that the character disappears.

That then made me think it was the fact that an element of an array is cleared out and not removed but in changing the value of the array element to “” it still has that symbol.

What is the symbol called (a little rectangle that is tall and thin)?

Any I ideas on what’s causing it?


:

    'declares an array
        Dim ping_stdout_array() As String
        'splits the string 's' into lines and then passes each string into array ping_stdout_array
        ping_stdout_array = s.Split(vbLf)

        'iterates 0 - the size of the array
        For i As Integer = 0 To UBound(ping_stdout_array)
            'declares a variable type boolean
            Dim t_or_f As Boolean
            'searches each line of the array for the word "exit" and returns - true or false into
            'the 'boolean' variable
            t_or_f = InStr(ping_stdout_array(i), "exit")
            'conditional - if true then clear array element 'i'. 1 is the number of elements to clear
            If t_or_f = "True" Then
                'Array.Clear(ping_stdout_array, i, 1)

            End If
         
        Next

        'joins the array back together and passes it back into the s variable
        s = String.Join(vbLf, ping_stdout_array)
       

        'displays stdout of ping to "textbox" on form1
        TextBox.Text = s


The Dark Aug 26th, 2006 11:37 AM

I think the multiline edit control needs a CR-LF sequence for the end of lines.
Try using vbCrLf in your join statement.

hush Aug 26th, 2006 11:44 AM

It got rid of the symbol at the end of the string. But put one at the end of each line.

I guess that’s the sysmbol for Cr (carriage return) then.

Thanks for the swift reply

The Dark Aug 26th, 2006 11:47 AM

Quote:

Originally Posted by hush
It got rid of the symbol at the end of the string. But put one at the end of each line.

I guess that’s the sysmbol for Cr (carriage return) then.

Thanks for the swift reply

You should change the vbLf in the split line too.
Otherwise you would be leaving the original CRs in the strings after splitting, which would give your two CRs and one LF when you joined them back again.

hush Aug 26th, 2006 1:35 PM

That puts three of them next to each other on a new line.

But I then tried every combination as I see what you are getting at and I found one that works properly:

:

ping_stdout_array = s.Split(vbCrLf)



:

s = String.Join(vbCr, ping_stdout_array)

thanks for the help The Dark:D


All times are GMT -5. The time now is 1:05 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC