Okay Ive got a Huge problem something that my current Programming skills will not be able
to fix. Ive got a Program and a text file , this text file gets load into the list box
but that's not the problem. The problem is that when i make the text file it makes a open line and this line gets loaded into the list box and i don't want empty items. But i don't know how to stop this weird action
SO here's code that i use to make text file

Public MySettingfile As String = My.Application.Info.DirectoryPath & "\Process History.MemFreo"
Dim myCoolWriter As New IO.StreamWriter(MySettingfile, True, System.Text.Encoding.Default)
myCoolWriter.WriteLine()
myCoolWriter.Close()

:D So please help a Newbie out :X

Edited 5 Years Ago by VB 2012: No reason really :D

I don't know how you read in your settings file so maybe this gives you an idea:

Dim dummy() As String = New String() {"", "entry 1", "entry 2", Nothing, "entry 3"}
		ListBox1.DataSource = dummy.Where(Function(s) Not String.IsNullOrEmpty(s)).ToArray

I use this

Dim WoofRead = New IO.StreamReader(MySettingfil)
        While (WoofRead.Peek() > -1)
            ListBox2.Items.Add(WoofRead.ReadLine)
        End While
        WoofRead.Close()

then change it to:

Dim WoofRead = New IO.StreamReader(MySettingfil)
        While (WoofRead.Peek() > -1)
        dim currentLine as string = WoofRead.ReadLine
        if string.isnullorempty(currentLine) then continue for
            ListBox2.Items.Add(currentLine)
        End While
        WoofRead.Close()

Im not sure what you mean by this

if string.isnullorempty(currentLine) then continue for

sorry had a typo in. so here you go:

Dim WoofRead = New IO.StreamReader(MySettingfil)
		While (WoofRead.Peek() > -1)
			Dim currentLine As String = WoofRead.ReadLine
			If String.IsNullOrEmpty(currentLine) Then 'if line is empty then go to next line
				Continue While
			End If
			ListBox2.Items.Add(currentLine)
		End While
		WoofRead.Close()
This question has already been answered. Start a new discussion instead.