Use the PictureBox.LoadCompleted event.
How to know that Image is successfully loaded in Picturebox from the Internet?
-
27-09-2022 - |
Vra
I am using "ImageLocation" property of PictuerBox to get a picture from the web.
PB1.ImageLocation = "http://www.example.com/picture.png"
Some times the image which has to load in picture box from web is very large in size and can not be appear instantly in PictureBox. I need to conform that Image has successfully loaded in Picturebox, before performing next operation. I have to Enable some controls just after loading of image from web.
Is there any way to conform this? (Note: My PictureBox has an initial image also.)
Oplossing
Ander wenke
Okay see what I did for mine was just download the picture. The image normally takes a while to start getting put into the picture box.
Here is my code:
If (My.Computer.FileExists("http://www.example.com/picture.png")) Then
My.Computer.Network.DownloadFile("http://www.example.com/picture.png", <Some Location>)
PB1.ImageLocation = <Some location>
Else
End
End If
It may not be the most efficient way - but I can see it as a simple way of making it work.
Dunno if it's working or not, can't access Visual Studio at the moment