Program freeze when using WebClient

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hey-

I made a program that gets some html and grabs all the URL's that end with .bin (threw regexp) and pass it to a function i have called DownloadFile(url)

The problem is that my whole app is locked untell the prossess completes. I even have some text before the function call that isnt shown untill after. If i put a message box inbetween function calls (i was just testing) it will show the text outputs. I've been reading some async stuff but i cant get it implemented. Any help would be great, thanx.

Code:
Function DownLoadFile(ByVal remoteUri As String)
Dim myStringWebResource As String = remoteUri
Dim myWebClient As New WebClient

Dim i As Integer = InStrRev(remoteUri, "/")
Dim fileName As String = Mid(remoteUri, i + 1)

txtMessages.Text = "Downloading File from: " & myStringWebResource

If System.IO.File.Exists(Application.StartupPath & "\Updates\" & fileName) Then
txtProgress.Text &= fileName & " Exists Already." & ControlChars.NewLine
Return 0
End If
myWebClient.DownloadFile(myStringWebResource, Application.StartupPath & "\Updates\" & fileName)
myWebClient.Dispose()

txtProgress.Text &= "Successfully Downloaded file " & fileName & ControlChars.NewLine
End Function

PS: ideas for the future include a progress bar and compair file sizes (from server and from local)
--------------------------------
From: Eric Helgeson

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>m6EHaBPt306ssL8QHjelcw==</Id>
.



Relevant Pages

  • Re: removing Whitespace using regexp
    ... html and then write a parser to parse the properly formatted html. ... That way you can get rid of your whitespace problem and deal with the cosmos ... the remaining text using regexp. ... Here you can see some white space ...
    (comp.lang.ruby)
  • Re: HTML scraping
    ... I've read the "Writing HTML parser wasn't as hard as I thought it'd be" ... regexp and the full DOM monster. ... you can still infer the semantics from the physical ...
    (comp.lang.lisp)
  • regexp and stack overflow
    ... it works well for some html file but crash over other with the following ... RegexpError: Stack overflow in regexp matcher: ... strip out all the contents of scripts, all the html tags with their ... the prog failes for a file having the following parts for script: ...
    (comp.lang.ruby)
  • Re: (repost): Very tough question, about HTML manipulation
    ... RegExp to a whole chunk of stuff block elements. ... HTML Source code: ... Another approach will be using DOM and textRange at the same time. ... Again create a Cursor and Reference Range. ...
    (microsoft.public.scripting.jscript)
  • Re: removing Whitespace using regexp
    ... Previously I posted a topic on how to strip all html tags and getting ... the remaining text using regexp. ... there are problems with parsing HTML with regexps? ... There are easy ways to strip all the whitespace, ...
    (comp.lang.ruby)