This is a migrated thread and some comments may be shown as answers.

how to display a picture in telerik reportingPicture box

1 Answer 36 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Peng
Top achievements
Rank 1
Peng asked on 08 Jan 2014, 09:25 PM
Hi

I want to show the picture in a picturebox
picture is store as text in database table. my code is :

            string bmpStr = "=Fields.Sign1";
            int NumberChars = bmpStr.Length;
            byte[] myBytes = new byte[NumberChars / 2];
            for (int i = 0; i < NumberChars; i += 2)
            {
                myBytes[i / 2] = Convert.ToByte(bmpStr.Substring(i, 2), 16);
            }

            System.IO.MemoryStream ms = new System.IO.MemoryStream(myBytes);
            System.Drawing.Image img = System.Drawing.Image.FromStream(ms);
            this.pictureBox2.Value = img;

Fields.Sign1 is coming from a database which store as text field in sql server but it is image
can any one help me in this please???
           

1 Answer, 1 is accepted

Sort by
0
IvanY
Telerik team
answered on 13 Jan 2014, 02:13 PM
Hi Peng,

You will have to create a user function in order to achieve your goal. The user function should accept one parameter which will be the value of Fields.Sign1 and should return an image. Then in it copy the code from this post and return the resulting image. Finally use bindings to set the value of the Picturebox.

Regards,
IvanY
Telerik

New HTML5/JS REPORT VIEWER with MOBILE AND TOUCH SUPPORT available in Telerik Reporting Q3 2013! Get the new Reporting version from your account or download a trial.

Tags
General Discussions
Asked by
Peng
Top achievements
Rank 1
Answers by
IvanY
Telerik team
Share this question
or