|
-
Sep 15th, 2002, 08:01 AM
#1
Thread Starter
New Member
Update backGround Image, little help please :)
Hi!
I have the following code to download a JPEG from a website and display it as the background image in Panel (panel1) when I click a form button. This works fine the first time but if I try and click the button again it says the resource "c:\dan.jpg" is being used.
My question is is there a way to download an image from a site and update an image on a form time and time again - I'm not too experienced with VB.net so any help would be most appretiated
I've included my code below...
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim wc As New System.Net.WebClient()
wc.DownloadFile("http://***.**.***.**/halfsize.jpg", _
"c:\dan.jpg")
Dim backgroundImage As Image = Image.FromFile("C:\dan.jpg")
Panel1.BackgroundImage = backgroundImage
wc.Dispose()
Dim fsof As System.IO.File
fsof.Delete("c:\dan.jpg")
End Sub
Many thanks
da
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|