Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Anonymous
in reply to: Anonymous

Solved with this code:

 

 

 

Public NotInheritable Class IPictureDispConverter : Inherits System.Windows.Forms.AxHost

        Private Sub New()

            MyBase.New("")

        End Sub


        Public Shared Function ImageToPictureDisp(image As Image) As IPictureDisp

            Try

                Return DirectCast(GetIPictureDispFromPicture(image), IPictureDisp)

            Catch ex As Exception

                'Add error message or logging here if desired.

                'Handle the conversion error by simply returning Nothing.

                Return Nothing

            End Try

        End Function



        Public Shared Function PictureDispToImage(pictureDisp As IPictureDisp) As Image

            Try

                Return GetPictureFromIPicture(pictureDisp)

            Catch ex As Exception

                'Add error message or logging here if desired.

                'Handle the conversion error by simply returning Nothing.

                Return Nothing

            End Try

        End Function

    End Class