Simple condition not working for listbox

OK, so fixing the quotes allowed it to compile.

However, it’s doing the opposite of what we want. It’s only putting “WORKSTATION” in the list box, not excluding it.

Also, it’s got two garbage characters in front of “WORKSTATION”. I fixed this earlier by using UTF16 in my original code, but even changing it with you code didn’t work this time.

In relation to what?

My original code, KEM and your suggestion I just did, or your original idea to put it in an array?

Kems code already puts the file into an array.

Looking at the code it should work fine. If the Line string does not contain ‘workstation’, it will add the Line to the listbox.

That line you wanted me to add has been deleted.

Not tested but should work.

Dim vendors As FolderItem = SpecialFolder.Temporary.child(“WK_Vend.txt”)
Dim t as TextInputStream

t = TextInputStream.Open(vendors)
t.Encoding = Encodings.UTF16
var contents as string = t.ReadAll

contents = contents.ConvertEncoding( Encodings.UTF8 )
contents = contents.ReplaceLineEndings( &uA )
var lines() as string = contents.Split( &uA )

for each line as string in lines
if line.IndexOf( “WORKSTATION” ) = -1 then
next line

Perfect! That’s the ticket! Thanks Chris and KEM!!!