VB.Net - Remove empty items in ListBox
<p>I want to remove empty items from my listbox that looks something like this:</p>

<pre><code>book1
book2

book3

book4
book5
</code></pre>

<p>And so on..</p>

<p>I have tried this code:</p>

<pre><code>Dim i As Integer = 0
        Do While (ListBox1.Items.Count) - 1 &gt;= i
            If String.IsNullOrEmpty(ListBox1.Items(i)) Then
                ListBox1.Items.Remove(ListBox1.Items(i))
                i -= 1
            End If
            i += 1
        Loop
</code></pre>

<p>And i don't know why it's not working.</p>