problem running system.net.webclient and process.start off a control event
Posted
by Rob
on Stack Overflow
See other posts from Stack Overflow
or by Rob
Published on 2010-06-06T04:35:24Z
Indexed on
2010/06/06
4:42 UTC
Read the original article
Hit count: 466
The following code causes my vs 2008 wpf project to hang, I'm not sure why. Both Part 1 and Part 2 work perfectly fine independently, but when I run them together on an control event (click a button for example) the program hangs. I've also tried shell execute for part 2 - same results. However, this code when run within the form loaded event works fine. Any insights would be truly appreciated.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles Button1.Click
'Part 1
Dim myWebClient As System.Net.WebClient = New System.Net.WebClient
Dim CurrentDataFileContents As String = myWebClient.DownloadString("http://www.xyz.com")
myWebClient.Dispose()
'Part 2
System.Diagnostics.Process.Start("http://www.test.com")
End Sub
© Stack Overflow or respective owner