http://www.daniweb.com/forum58.html
1. You declare piccollect, assign it memory and then never use it.
2. You ask how to handle multiple picture boxes. Don't hardcode the picture box!!!!
[code=vb]
Public Function GetByteArrayFromImage2(ByRef pb as PictureBox ) As Byte()
Dim ms As New System.IO.MemoryStream
With pb
.Image.Save(ms, pb.Image.RawFormat)
End With
[\code]
...
[code=vb]
Dim a(0) as Byte
Dim b(0) as Byte
a = GetByteArrayFromImage2(picturebox1)
b = GetByteArrayFromImage2(Picturebox2)
[\code]
3. "Return outBytes" terminates your logic, the last two statements are never executed. The only way they would execute is if the above statement was in an If statement and the false path is followed.