mercredi 6 mai 2015

Text file not loading information into Listbox

I'm trying to get the content from a text file into a Listbox, but I can't get it to work. It works fine however with a text box.

Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoad.Click      
Dim filename As String  
        Dim recipereader As StreamReader  
        ofdLoad.ShowDialog()      
        filename = ofdLoad.FileName
        If filename <> "" Then  
            recipereader = File.OpenText(filename)  
            ListBox1.Text = recipereader.ReadToEnd  
            recipereader.Close()  
        End If  
    End Sub  
End Class

What am I missing?

Aucun commentaire:

Enregistrer un commentaire