Image Viewer CP ActiveX Control

LoadFromStream

 

Load the image from IStream. 

Public Function LoadFromStream( _
   ByVal pStream As IStream
) As Bool

 

Parameter

pStream
   the stream of image.


Return Value

Return true - successful
Return false- Failed


Example

   

Visual Basic Syntax

strFilePath = "C:\temp\yourimage.jpg"
Set pStream = New ADODB.Stream
pStream.Type = adTypeBinary
pStream.Open
pStream.LoadFromFile strFilePath
ImageViewer1.LoadFromStream pStream

or Read IMAGE FIELD from SQL server

 Set strStream = New ADODB.Stream

 strStream.Type = adTypeBinary

 strStream.Open

 strStream.Write rstRecordset.Fields("YourImageField").Value ‘Field type Image

  ImageViewer1.LoadFromStream strStream