Click here to Skip to main content
15,040,212 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Experts,

How can i pass Image from Picture Box to Microsoft Report.

Updated 3-May-21 15:26pm
Sandeep Mewara 21-Feb-11 3:04am
Not clear.

1. MS report == SSRS?
2. Report build at runtime?
3. picture box image as in whats the source?
[no name] 21-Feb-11 3:18am
In or C# have a feature of generating report with the help of Crystal Report Or Microsoft Report.

MicrosoftReportVIewer is used to show Microsoft Report.

Everything is fair. But If I want to pass the image in ReportViewer.

then i have no idea .

1 solution

First you should save as picture in your Image from Picture Box.
And then you can pass your existing image file path as string ,

 string imagepath = "file:///" + "C:\\image.jpg";
             this.reportViewer1.LocalReport.EnableExternalImages = true;
             ReportParameter[] param = new ReportParameter[1];
param[0] = new ReportParameter("Path", imagepath);

In rdlc file you create Image box and then add Report parameter (Path).

After you add parameter you can insert in image value from parmaeter(Path).

May be helpful,

Theingi Win
[no name] 21-Feb-11 3:40am
Hello Sir,

It generate an Error :

Microsoft.Reporting.WinForms.LocalProcessingException was unhandled
Message="An error occurred during local report processing."
at Microsoft.Reporting.WinForms.LocalReport.SetParameters(IEnumerable`1 parameters)
at WindowsFormsApplication1.Form1.button1_Click(Object sender, EventArgs e) in C:\Users\Anubhava\Documents\Visual Studio 2008\Projects\WindowsFormsApplication3\WindowsFormsApplication3\Form1.cs:line 30
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at WindowsFormsApplication1.Program.Main() in C:\Users\Anubhava\Documents\Visual Studio 2008\Projects\WindowsFormsApplication3\WindowsFormsApplication3\Program.cs:line 17
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: Microsoft.ReportingServices.Diagnostics.Utilities.UnknownReportParameterException
Message="An attempt was made to set a report parameter 'Path' that is not defined in this report."
at Microsoft.ReportingServices.ReportProcessing.ParameterInfoCollection.Combine(ParameterInfoCollection oldParameters, ParameterInfoCollection newParameters, Boolean checkReadOnly, Boolean ignoreNewQueryParams, Boolean isParameterDefinitionUpdate, CultureInfo culture)
at Microsoft.Reporting.LocalService.GetReportParameters(CatalogItemContext reportContext, NameValueCollection userSpecifiedValues, ParameterInfoCollection baseLineParameters, DatasourceCredentialsCollection credentials, ReportRuntimeSetup reportRuntimeSetup)
at Microsoft.Reporting.WinForms.LocalReport.SetParameters(IEnumerable`1 parameters)
Theingi Win 21-Feb-11 3:54am
You should check in your report ,
In your rdlc file you add like this
Report->Report Parameters->In Name text box add Path -> In Data type text box choose String -> In Prompt text box add Path
Pls Try Again eg-Anubhava!

Best Regard
Theingi Win
[no name] 21-Feb-11 4:18am
It's working fine.
I was pass value without "File:///"

fjdiewornncalwe 21-Feb-11 8:48am
Perhaps you could reward Theingi Win for his help by marking his answer as correct and voting 5 if it is correct. Cheers.
Theingi Win 21-Feb-11 4:25am
Welcome! :)
[no name] 21-Feb-11 23:04pm
ok done

AnasChavadi 1-Aug-18 4:59am
Thank you , its working

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900