2014-10-08 60 views
0

我已经写了这个代码来检索图像从数据库到图片框。我得到了这些错误为什么我的错误参数在检索图像到图片框时无效?

'参数无效'

在该行pictureBox1.Image = Image.FromStream(stm);

Byte[] imagebyte = new Byte[0]; 
imagebyte = (Byte[])(dr["Pic_Image"]); 
MemoryStream stm = new MemoryStream(imagebyte); 
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; 
pictureBox1.Image = Image.FromStream(stm); 

请你解决这个错误?

+0

你如何解决这个问题的答案我 – 2015-12-27 21:49:54

+0

参数在这里失去了'昏暗的画面为字节()= GetBytes会(ListView2.Items(指数).SubItems(8)。文本) ()= GetBytes(ListView2。)Dim image as ImageConverter() PictureBox1.Image = DirectCast(converter.ConvertFrom(picture),Image)' – 2015-12-27 21:49:56

回答

0

当您提供的流,预计将下列文件之一:

BMP

GIF

JPEG

PNG

TIFF

请确保您的文件在这些格式之一

+0

我已经拍摄图像格式为JPEG – 2014-10-08 11:07:03

+0

此处缺少参数。 Items(index).SubItems(8).Text) Dim converter As New ImageConverter() PictureBox1.Image = DirectCast(converter.ConvertFrom(picture),Image) – 2015-12-27 21:49:11

相关问题