Avatar of suvmitra
suvmitra
Flag for India asked on

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

Is there a way to populate a list box from a text file resides in my website directory?
 
.NET Programming

Avatar of undefined
Last Comment
Maulik Modi

8/22/2022 - Mon
Maulik Modi

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

suvmitra

ASKER
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.
ASKER CERTIFIED SOLUTION
Maulik Modi

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck