Entering values into a ListView in VB.NET

How do you get the values from the output of this program from the dictionary into two columns. One column should cater for the bad words, while the other column should cater for the good words.

Dim inputFile As String = “C:\Users\Acer\Documents\Visual Studio 2010\Projects\WindowsApplication3\WindowsApplication3\bin\output2.txt”

    If File.Exists(inputFile) Then
        Using sr As New StreamReader(inputFile)
            While Not sr.EndOfStream
                Dim wordParts = sr.ReadLine.Split("|"c)
                If wordParts.Count >= 2 Then
                    AutoComplete.Add(wordParts(0).ToString & wordParts(1).ToString)
                End If
            End While
        End Using
    Else
        Throw New IOException(String.Format("Input file {0} not found.", inputFile))
    End If

Another code

        For Each Apex As String In AutoComplete


            If Apex.StartsWith(wordParts) = True And wordParts <> "" And wordParts <> " " Then


                'Split the Apex string into 2 words on the | character

                Dim words() As String = Apex.Split("|"c)


                Dim lvi As New ListViewItem(words(0)) 'add the 1st word

                lvi.SubItems.Add(words(1)) 'add the 2nd word

                ListView1.Items.Add(lvi)

            End If

        Next

In Xojo, you would use a FolderItem to point to the file, a TextInputStream to read the file and a ListBox to display the data.

This is untested, but should give you an idea:

Dim inputFile As New FolderItem("path/to/myfile.txt") Dim sr As TextInputStream sr = TextInputStream.Open(inputFile) While Not input.EOF Dim wordParts() As String = sr.ReadLine.Split("|") If wordParts.Ubound >= 1 Then AutoCompleteList.AddRow(wordParts(0), wordParts(1)) End If Wend sr.Close

You may want to ask your question in the Microsoft VB forum :
https://social.msdn.microsoft.com/Forums/en-US/home?forum=vbgeneral&filter=alltypes

I have dealt with them but no help. The problem with them is that they don’t explain to you solutions in detail.

That is why Xojo is so great. The product is only part of the magic. The community is awesome.

However, there are some specific VB. NET aspects only the Microsoft MVP may have the answer for.

Michel Bujardet, I see you know that, but I was attracted to this forum because of how some questions were answered. To see that there are alot of mature people not youngsters who are capable of solving my problems.

Paul Lefebvre, what was this code wend you posted at the bottom of your code?

Paul Lefebvre,

This code is for putting lines in a formatted direction in a new file, not reading a file.
Dim inputFile As New FolderItem(“path/to/myfile.txt”)
Dim sr As TextInputStream
sr = TextInputStream.Open(inputFile)
While Not Input.EOF
Dim wordParts() As String = sr.ReadLine.Split("|")
If wordParts.Ubound >= 1 Then
AutoCompleteList.AddRow(wordParts(0), wordParts(1))
End If
End
sr.Close()
()

Wend is the closing statement for While. http://documentation.xojo.com/index.php/While...Wend

VB. NET uses While End

Kelvin,

Could You have the kindness to attach an example of the text file for each of the cases.

Unfortunately Microsoft have made the public Q&A to a mess. As a consequence many MVPs have escaped and no longer visit the forums…