Populate a list box from a text file resides in FTP vb.net

suvmitra
suvmitra used Ask the Experts™
on
Is there a way to populate a list box from a text file resides in my website directory?
 
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
windows forms code link
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

<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 Using
End Sub

Open in new window

Author

Commented:
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.
Yes, you are right.

If you are doing windows application then You need to programmetically login to the site and you will need FTP access to the website - FTP URL & Login credentials.

Here's the links that will help you get started:
http://support.microsoft.com/default.aspx?scid=kb;en-us;812404
http://www.codeproject.com/KB/IP/FtpClient.aspx?fid=225949&df=90&mpp=25&noise=3&sort=Position&view=Quick&fr=201

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial