Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27351

Removing specific chars from listbox

$
0
0
Hey Guys,

i generally want to make an application, which loads a textfile (the file contains some number combinations and unwanted chars in each line, like "12335243</br>"), removes all dublicates and add this then to a listbox.
Generally, the program should remove all chars which i do not want to be in the listbox, like <, >, /, etc.
I already made the dublicate removing part, but im stuck with the "deleting of specific chars in the listbox".
Would be cool if anybody here can help me :D

My code:

Code:

Private Sub OpenFileDialog1_FileOk(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk
        GhostTextBox1.Text = OpenFileDialog1.FileName
        Dim sr As New StreamReader(OpenFileDialog1.FileName)
        Dim MyArray As New ArrayList
        Dim strLine As String

        Do While sr.Peek <> -1
            strLine = sr.ReadLine()
            If MyArray.Contains(strLine) = False Then
                MyArray.Add(strLine)
                ListBox1.Items.Add(strLine)
            End If
        Loop
        sr.Close()


    End Sub


Viewing all articles
Browse latest Browse all 27351

Trending Articles