I need someone to look over this code for me and to tell me what I am doing wrong
I have a imageview on the form
Public Sub ConvertImage()
Dim bmpFilePath As String = "till_logo.bmp"
Dim byteArray As Byte[]
' Load the BMP image into the Image view
FMain.ImageView1.Image = Image.Load(bmpFilePath)
' Convert the BMP image to a byte array
byteArray = ImageToByteArray(FMain.ImageView1.Image)
' Now 'byteArray' contains the byte representation of the BMP image
End
Private Function ImageToByteArray(image As Image) As Byte[]
Dim stream As File
' Create a memory stream to store the image data
stream = Open Memory image For Read Write
' Save the image to the memory stream
image.Save(stream)
' Seek to the beginning of the memory stream
stream.Seek(0)
' Read the byte array from the memory stream
Return ImageToByteArray = stream.Read(stream.Length)
' Close the memory stream
stream.Close
End
It errors out at the stream = Open Memory image For Read Write in the Private Function ImageToByteArray function
The Error Message is "Type mismatch: Wanted pointer, got Image instead (ImageControl:22)
Anyone have any idea's?