0
我从DataGridView
结合的图像PictureBox
当一个问题,我得到以下错误无法投射“System.String”类型的对象以键入“System.Byte []”。为什么?
的对象无法转换类型“System.String”为类型“System.Byte []”
这里是我的代码:
Private Sub BindToText()
With dgv_EmployeeMainFile
...
Dim bytes As [Byte]() = .CurrentRow.Cells(31).Value
Dim ms As New MemoryStream(bytes)
PictureEmp.Image = Image.FromStream(ms)
End With
End Sub
显然,'Cells(31)'包含一个字符串。如果ImageColumn存在,你不需要将它转换为byte()tp在其他地方显示 - 它将是一个包装在Object中的图像 – Plutonix
你期望在'.CurrentRow.Cells(31).Value'中找到什么? –