本文介绍了如何将字节[]转换为图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要帮助找到此代码段中的错误:

byte[] a = objstud.viewtudentphoto(txtadminno.Text);
System.IO.MemoryStream ms = new System.IO.MemoryStream(a);
pictureBox2.Image = Image.FromStream(ms);



我在这里遇到错误:

pictureBox2.Image = Image.FromStream(ms);



这里objstud.viewtudentphoto(txtadminno.Text)返回图像
来自数据库

任何帮助将不胜感激.

谢谢.

解决方案



I need help locating the error in this code snippet:

byte[] a = objstud.viewtudentphoto(txtadminno.Text);
System.IO.MemoryStream ms = new System.IO.MemoryStream(a);
pictureBox2.Image = Image.FromStream(ms);



I am getting the error here:

pictureBox2.Image = Image.FromStream(ms);



here objstud.viewtudentphoto(txtadminno.Text) returns an image
from database

Any help is greatly appreciated.

Thanks.

解决方案




这篇关于如何将字节[]转换为图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 22:16