Public Function PictureBoxImageToBytes(ByVal picBox As PictureBox) As Byte()
If (picBox IsNot Nothing) AndAlso (picBox.Image IsNot Nothing) Then
Dim bmp As New Bitmap(picBox.Image)Dim ms As New System.IO.MemoryStream()
bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp)
Dim buff As Byte() = ms.ToArray()
ms.Close()
ms.Dispose()
Return buff
Else
Return Nothing
End If
End Function