<asp:FileUpload runat="server" ID="FileUpload1"/> <asp:Button ID="btnUpload" runat="server" onclick="btnUpload_Click" Text="Upload" /> <asp:ListBox runat="server" ID="ListBox1"></asp:ListBox>Protected Sub btnUpload_Click(sender As Object, e As EventArgs) Using stRead As New StreamReader(FileUpload1.PostedFile.InputStream) While Not stRead.EndOfStream ListBox1.Items.Add(stRead.ReadLine()) End While End UsingEnd Sub
I am using VB.NET and creating a windows application. The example you provided is very good. my file say webpages.txt will be in my website. i need that file to read and populated as list box items.
I think for that i need to login into my website through the application providing the login credentials..then find out the webpages.txt and return its all lines and populate the list box.
http://www.vb-helper.com/howto_net_load_listbox_from_file.html
To do it in ASP.NET with fileupload for text file upload and listbox displaying each line in text file
source; http://stackoverflow.com/questions/1445486/read-from-text-file-into-listbox
Let me know if there is gap in understanding
Open in new window