2017-03-04 90 views
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 
+1

显然,'Cells(31)'包含一个字符串。如果ImageColumn存在,你不需要将它转换为byte()tp在其他地方显示 - 它将是一个包装在Object中的图像 – Plutonix

+0

你期望在'.CurrentRow.Cells(31).Value'中找到什么? –

回答

相关问题