Marvin Gapuz

Marvin Gapuz

  • NA
  • 85
  • 5.6k

System.InvalidCastException: 'Unable to cast object of type

Feb 23 2019 4:51 AM
 byte[] ImageArray = (byte[])dgvMPdetails.CurrentRow.Cells[16].Value;
if (ImageArray.Length == 0)
{
MessageBox.Show("Error");
}
else
{
ImageByteArrays = ImageArray;
pbx1.Image = Image.FromStream(new MemoryStream(ImageArray));
}
 
 Hello Please Help me. I keep on encountering this problem whenever I run this code.
 
System.InvalidCastException: 'Unable to cast object of type 'System.String' to type 'System.Byte[]'.'

Answers (1)