Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
4.8k views
in .NET FTP by (200 points)
Hi,

I have a big problem on implement a progress bar during the upload of a file on the server. :oops:
I need create the progress bar in a Vb.NET application where I have implemented the ftp function.

Someone can give me an exemple on how create a progress bar? I use the free ftp library

Thank you very much for the help
Gianluigi - Italy

5 Answers

0 votes
by (700 points)
Add a progress bar to your form. Run the ftp client in a separate thread and attach to the bytes transfered event. When the event fires, update the progress bar.
0 votes
by (200 points)
HI,

Thank you for the response,

may you give me an exemple?
I'm not very expert with "separate thread ", what is exactly?

Thank you
Gianluigi
0 votes
by (700 points)
Well, first you need to learn about threading. A quick google search turned up a bunch of good informational articles about threading in VB.NET. Here's a good one to use as a starting point:http://www.devx.com/getHelpOn/10MinuteSolution/20365. After reading through and understanding that article, then setup a thread in your app whose soul purpose is to do your file transfers over the ftp connection. That thread will be tranferring and firing off your bytes transfered event. The event code updates your progress bar that is running in your main thread. I hope that helps. I don't have a good specific example in vb as I typically use C#, but that article talks about threading in vb, so it should get you going in the right direction.
0 votes
by (200 points)
Hi,

May you send me en exemple in C#?
I'm able to read the C#

Thank you very much for your help
Gianluigi
0 votes
by (51.6k points)
Just so you know, edtFTPnet/PRO 2.0 has just been released. It features ProFTPConnection which supports asynchronous methods that make it a lot easier to do things like progress bars since you don't need to worry about using separate threads. You simply handle the BytesTransferred event in your form and launch your download using BeginDownloadFile() instead of DownloadFile(). BeginDownloadFile() returns control to the caller immediately and downloads the file in the background. You can download a 30-day trial from http://www.enterprisedt.com/products/edtftpnetpro/download.html.

- Hans (EDT Support)

Categories

...