cannot be converted to '1-dimensional array of Byte'.

superstud101

Member
Joined
May 27, 2008
Messages
7
Programming Experience
Beginner
hi this is my code and i get this error
"Value of type 'System.Drawing.Bitmap' cannot be converted to '1-dimensional array of Byte'."

VB.NET:
[COLOR="Red"]dim FirstIcon() as byte = My.Resources.resign_icon1[/COLOR]
        FirstIconSize = BitConverter.GetBytes(FirstIcon.Length)
        Array.Reverse(FirstIconSize)
        SecondIcon = My.Resources.resign_icon_inv
        SecondIconSize = BitConverter.GetBytes(SecondIcon.Length)
        Array.Reverse(SecondIconSize)

could some one please tell me what im doing wrong please
 
You need to convert the icon to bytes before you can assign it to your FirstIcon variable:

Something like this would do the trick:
Dim FirstIcon As Byte = DirectCast(My.Resources.resign_icon1, Byte)

Although I'm not sure why you'd want to be saving an image as bytes anyways
 
Back
Top