ImageMan ActiveX
Loading Images from the Internet

Images can be loaded from the Internet by setting the Picture property of the control to the URL of the image to be loaded. The URL must be prefixed with either HTTP:// , HTTPS:// , or FTP:// depending on which protocol should be used to load the image. After setting the Picture property, control will return to the application while the image loads in the background. When the image data has loaded or if an error occurs, the ReadyStateChange event will be fired. If the ReadyState property returns a value of 4 (CONTROL_LOADED) and the LoadStatus property is zero when the event fires, then the image has been loaded successfully. If LoadStatus is non-zero then an error occurred.

 

The following code loads an image from the URL http://www.data-tech.com/imgs/Im6alogo.gif:

 

ImageControl1.Picture = "http://www.data-tech.com/imgs/Im6alogo.gif"

...

Private Sub ImageMan1_ReadyStateChange()

  If ImageControl1.ReadyState = 4 Then

  If ImageControl1.LoadStatus = 0 Then

  ' Refresh the Image Control to display the image

  MsgBox "Finished Loading Image."

  ImageControl1.Refresh

  Else

  MsgBox "Error " & ImageControl1.LoadStatus & " occurred loading Image from Internet"

  End If

  End If

End Sub

 

 


© 2014 Data Techniques, Inc. All rights reserved.

Submit feedback on this topic