Results 1 to 6 of 6

Thread: how can i do two things at oncce

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2002
    Location
    marlow, england
    Posts
    1

    how can i do two things at oncce

    Hi

    I am tring to write a small ftp client in vb.net, i can get it do download file using wininet.dll and ftpgetfile to download the file, but as the files i want to download may be large i need some sort of progress indicator to show how much of the total is downloaded.

    i have tried using the file size.maxvalue indicatiors, but this won't work cos when i call the ftpgetfile, the system is stuck until then entire file is downloaded. how can i make this so it has a progress bar or shows the user how much has come down.

    any help would be much appreciated

    cheers

    YH

  2. #2
    hellswraith
    Guest
    You need to do some multithreading. You need to put the download operation on a seperate thread. Here is an article on the MSDN library site that should give you more information than you need to do this:
    http://msdn.microsoft.com/library/de...syncprocvb.asp

    Have fun.

  3. #3
    Hyperactive Member
    Join Date
    Dec 2001
    Location
    Dublin, Ireland
    Posts
    262
    Well threading in .net is cool but good http/ftp dlls should provide events to allow for download progress checking.

  4. #4
    Addicted Member
    Join Date
    Nov 2000
    Location
    San Diego - California
    Posts
    251
    You should fire the application.doevents method every now again so that the screen gets updated.

    You could also use a timer, and place the doevents in a timer.

  5. #5
    hellswraith
    Guest
    Originally posted by BryanJ
    You should fire the application.doevents method every now again so that the screen gets updated.

    You could also use a timer, and place the doevents in a timer.
    You shouldn't have to do that in VB.Net, at least not for what is being asked.

    For the problem at hand, having the download process and checking on a seperate thread is going to be ideal. You don't want something locking up the main form, and a seperate thread will do this. Have an object fire events to the main form telling the current status of the download. Then handle the UI implementation there.

  6. #6
    Addicted Member
    Join Date
    Nov 2000
    Location
    San Diego - California
    Posts
    251
    You are right, it is messy and it will sure to be a problem later.

    Creating another thread is the best solution.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width