有关如何将图像从数据绑定 datagidview 控件保存到 memoryStream 的任何示例?
我知道有了 PictureBox 我们可以做到
pictureBox1.Image.Save(ms, ImageFormat.Jpeg);
数据绑定的 DataGridViewImage 怎么样?
我收到错误“对象引用未设置为对象的实例”
Private Sub conv_photo()
'converting photo to binary data
Dim ms As MemoryStream = New MemoryStream()
TryCast(DataGridView1.Columns(1), DataGridViewImageColumn).Image.Save(ms, ImageFormat.Jpeg)`Right here error`
Dim photo_aray As Byte() = New Byte(CInt(ms.Length - 1)) {}
ms.Position = 0
ms.Read(photo_aray, 0, photo_aray.Length)
_Command.Parameters.AddWithValue("@_m_barrImg", photo_aray)
End Sub