<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp;amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx</link><description>If you are one of the people who used and enjoyed SQL Server Reporting Services (SSRS) in SQL 2000 and you wanted to use it in your windows/web applications without the server side components (just like what you are doing with Crystal Reports). So you</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#506184</link><pubDate>Wed, 21 Dec 2005 05:28:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:506184</guid><dc:creator>Sazzad</dc:creator><description>being a long time access reports user, i am missing the &amp;quot;OnFormat, OnPrint etc..&amp;quot; report events which is not available in reporting services.&lt;br&gt;&lt;br&gt;anyone knows how to overcome this limitation of reporting services ??</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#506712</link><pubDate>Thu, 22 Dec 2005 17:03:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:506712</guid><dc:creator>Mohamed Sharaf</dc:creator><description>Hello Sazzad,&lt;br&gt;       There are plenty of useful events of the ReportViewer control. Please take a look at this article &lt;a rel="nofollow" target="_new" href="http://msdn2.microsoft.com/en-us/library/ms255387.aspx"&gt;http://msdn2.microsoft.com/en-us/library/ms255387.aspx&lt;/a&gt; </description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#578060</link><pubDate>Tue, 18 Apr 2006 10:33:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:578060</guid><dc:creator>Eran</dc:creator><description>Great Article !&lt;br&gt;Thank You :)</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#593808</link><pubDate>Tue, 09 May 2006 21:04:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:593808</guid><dc:creator>Haitham El-Ghareeb</dc:creator><description>Simple as usual, full of data as usual too, so lovely blog contains nice articles with easy implementation, I know I have not been taking too many looks over your blog, but It is really nice. Good Luck with it.</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#595224</link><pubDate>Thu, 11 May 2006 12:34:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:595224</guid><dc:creator>Graham Angell</dc:creator><description>After many frustrating hours trying to get a custom assembly to work with ReportViewer I found your blog. &amp;nbsp;Everything now works fine. &amp;nbsp;My sincere thanks!</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#599336</link><pubDate>Wed, 17 May 2006 00:54:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:599336</guid><dc:creator>umangi Shah</dc:creator><description>I have separated assembly and reference it from my report and I get following error.&lt;br&gt;&lt;br&gt;Error while loading code module: ‘ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’. Details: Could not load file or assembly 'ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.&lt;br&gt;&lt;br&gt;you have mentioned following steps&lt;br&gt;Select the report file from Solution Explorer, Go to Properties Window and change its BuildAction to Content &lt;br&gt;Set Copy to output Directory property to Copy always or Copy if newer &lt;br&gt;In the form designer class (the partial class created by Visual Studio according to naming schema &amp;lt;FormName&amp;gt;.Designer.CS or &amp;lt;FormName&amp;gt;.Designer.VB) replace the line which instruct the ReportViewer to load the report file from resource file with another line that instruct the ReportViewer to load the report from current directory. &lt;br&gt;So this line &lt;br&gt;this.reportViewer1.LocalReport.ReportEmbeddedResource = &amp;quot;testLocalReport.Report1.rdlc&amp;quot;;&lt;br&gt;&lt;br&gt;With this line&lt;br&gt;this.reportViewer1.LocalReport.ReportPath = &amp;quot;Report1.rdlc&amp;quot;;&lt;br&gt;&lt;br&gt;Copy the dll that you are referencing to the Debug or Release directory of your application &lt;br&gt;Make the line that executes the report in the current appDomain first, then add the lines that trust the referenced assembly and all assemblies referenced by this assembly (see above)&lt;br&gt;&lt;br&gt;But When I click on rdlc file in solution explorer I don't see Build Action in Properties window. Do I miss something?&lt;br&gt; &lt;br&gt;&lt;br&gt;</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#606223</link><pubDate>Wed, 24 May 2006 21:24:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:606223</guid><dc:creator>Raja</dc:creator><description>Hi Mohammad,&lt;br&gt;&lt;br&gt;Your article is awesome and solved some of the mysteries I had....But now I have a problem of running the report (I am not using reportviewer control) which uses a custom assembly which in turn uses a web service to get the information required. I was able to get the report working in the preview mode but when I actually run it, It gave the exact error which you were talking in step 2 (Request for the permission of type 'System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.). It would be great if you can suggest me a measure to solve this. &lt;br&gt;&lt;br&gt;Thanks in Advance,&lt;br&gt;Raja</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#606313</link><pubDate>Wed, 24 May 2006 23:05:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:606313</guid><dc:creator>Amy</dc:creator><description>I have separated assembly and reference it from my report and I get following error. &lt;br&gt;&lt;br&gt;Error while loading code module: ‘ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’. Details: Could not load file or assembly 'ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. &lt;br&gt;&lt;br&gt;Your solution below:&lt;br&gt;&lt;br&gt;-----------------------------------------&lt;br&gt;For the people who are trying to move their code in separated assembly and reference it from their report, they would face another problem.&lt;br&gt;&lt;br&gt;If you are following the steps mentioned in MSDN regarding how to reference custom code (mentioned above). You will end up with this message &lt;br&gt;&lt;br&gt;Error while loading code module: ‘ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’. Details: Could not load file or assembly 'ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.&lt;br&gt;&lt;br&gt; &lt;br&gt;&lt;br&gt;After a lot of trials with this error, I found that I have to do the following.&lt;br&gt;&lt;br&gt;Select the report file from Solution Explorer, Go to Properties Window and change its BuildAction to Content &lt;br&gt;Set Copy to output Directory property to Copy always or Copy if newer &lt;br&gt;In the form designer class (the partial class created by Visual Studio according to naming schema &amp;lt;FormName&amp;gt;.Designer.CS or &amp;lt;FormName&amp;gt;.Designer.VB) replace the line which instruct the ReportViewer to load the report file from resource file with another line that instruct the ReportViewer to load the report from current directory. &lt;br&gt;So this line &lt;br&gt;this.reportViewer1.LocalReport.ReportEmbeddedResource = &amp;quot;testLocalReport.Report1.rdlc&amp;quot;;&lt;br&gt;&lt;br&gt;With this line&lt;br&gt;this.reportViewer1.LocalReport.ReportPath = &amp;quot;Report1.rdlc&amp;quot;;&lt;br&gt;&lt;br&gt;Copy the dll that you are referencing to the Debug or Release directory of your application &lt;br&gt;Make the line that executes the report in the current appDomain first, then add the lines that trust the referenced assembly and all assemblies referenced by this assembly (see above)&lt;br&gt;&lt;br&gt;-----------------------------------------&lt;br&gt;&lt;br&gt;applies to windows application. &amp;nbsp;Does anyone know how to solve it for a web application?</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#618350</link><pubDate>Tue, 06 Jun 2006 00:49:03 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:618350</guid><dc:creator>jholmes</dc:creator><description>I have the same problem Raja has. &amp;nbsp;Any suggestions on fixing it? &amp;nbsp;It's driving me crazy, not to mention I can't get my report working.&lt;br&gt;&lt;br&gt;</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#637330</link><pubDate>Mon, 19 Jun 2006 22:20:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:637330</guid><dc:creator>David Overton</dc:creator><description>I got round the file not found error by placing the file in &amp;quot;C:\Program Files\Microsoft Visual Studio 8\Common7\IDE&amp;quot;. &amp;nbsp;I still can't seem to reference the code, but this is a step closer.&lt;br&gt;&lt;br&gt;ttfn&lt;br&gt;&lt;br&gt;David</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#679977</link><pubDate>Thu, 27 Jul 2006 10:44:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:679977</guid><dc:creator>Seato</dc:creator><description>Bloody Brilliant! Been looking for this info for ages. It was doing my head in until I found this insightful post. &lt;br&gt;&lt;br&gt;Microsoft really suck with documentation on this Report stuff. Kodos to you for trawling through the code to get it work.&lt;br&gt;&lt;br&gt;Well done, and THANKS!</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#693619</link><pubDate>Wed, 09 Aug 2006 22:59:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:693619</guid><dc:creator>Bob</dc:creator><description>Anyone find solution for web apps yet?</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#702040</link><pubDate>Wed, 16 Aug 2006 07:15:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:702040</guid><dc:creator>Chris</dc:creator><description>What I would really like to do is refrerence some code in the current assembly instead of a custom assembly. &amp;nbsp;This would avoid all the nasty versioning issues that I think would come with a custom assembly. &amp;nbsp;Is this possible? &amp;nbsp;I am assuming not, since I have never seen it mentioned anywhere and I can't get it to work. &amp;nbsp;But I don't understand why it wouldn't be supported.&lt;br&gt;</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#702416</link><pubDate>Wed, 16 Aug 2006 15:13:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:702416</guid><dc:creator>Satish</dc:creator><description>Excellent Article. Thanks a lot.&lt;br&gt;Microsoft should learn something from this guy.</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#703170</link><pubDate>Thu, 17 Aug 2006 02:43:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:703170</guid><dc:creator>diego pego</dc:creator><description>Really great article. That helped a LOT. I'm thinking if Microsoft intended to made this cryptic... anyway, thanks again!!!</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#718944</link><pubDate>Thu, 24 Aug 2006 23:22:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:718944</guid><dc:creator>brunelli</dc:creator><description>Thank you Mohamed for the helpful post!&lt;br&gt;&lt;br&gt;If anybody accesses code from an custom assembly, don't forget to add the AllowPartialyTrustedCallers into the AssemblyInfo. If not, your report will run, but you may get an #Error where you use a method or member of the assembly.&lt;br&gt;&lt;br&gt;Found here, and very useful anyway....&lt;br&gt;&lt;br&gt;&lt;a rel="nofollow" target="_new" href="http://www.c-sharpcorner.com/UploadFile/balajiintel/CustomAssemblyinRS06302005081435AM/CustomAssemblyinRS.aspx?ArticleID=f3904516-e30a-401a-aa01-463636d78f18"&gt;http://www.c-sharpcorner.com/UploadFile/balajiintel/CustomAssemblyinRS06302005081435AM/CustomAssemblyinRS.aspx?ArticleID=f3904516-e30a-401a-aa01-463636d78f18&lt;/a&gt;</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#772162</link><pubDate>Tue, 26 Sep 2006 16:05:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:772162</guid><dc:creator>lsites</dc:creator><description>How do you get ClickOnce to deploy the rdlc files if you put the reports into a separate assembly</description></item><item><title>Security problem</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#789505</link><pubDate>Wed, 04 Oct 2006 15:29:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:789505</guid><dc:creator>Jelle</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have a working .exe with a report viewer with a custom dll to look up use a resource file so that I can have multiple languages in my reports. However, if I change this project to a class and use it from another .exe I get the next nasty error(s). Seems some permission problems.. I tried adding [assembly: AllowPartiallyTrustedCallers] to the custom assembly, but without success. Who can help me on this one?&lt;/p&gt;
&lt;p&gt;Jelle &lt;/p&gt;
&lt;p&gt;Microsoft.Reporting.WinForms.LocalProcessingException: An error occurred during local report processing. ---&amp;gt; Microsoft.Reporting.DefinitionInvalidException: The definition of the report 'Main Report' is invalid. ---&amp;gt; Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: An unexpected error occurred in Report Processing. ---&amp;gt; System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark&amp;amp; stackMark, Boolean isPermSet)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at System.Security.CodeAccessPermission.Demand()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark&amp;amp; stackMark, Boolean forIntrospection)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at System.Reflection.Assembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, StackCrawlMark&amp;amp; stackMark)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at System.Reflection.Assembly.LoadFrom(String assemblyFile, Evidence securityEvidence)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at System.Activator.CreateInstanceFrom(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at System.AppDomain.CreateInstanceFrom(String assemblyFile, String typeName)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at System.AppDomain.CreateInstanceFromAndUnwrap(String assemblyName, String typeName)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at System.AppDomain.CreateInstanceFromAndUnwrap(String assemblyName, String typeName)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at Microsoft.ReportingServices.Diagnostics.AssemblyLocationResolver.CreateResolver(AppDomain tempAppDomain)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at Microsoft.ReportingServices.ReportProcessing.ReportCompileTime.ResolveAssemblylocations(StringList codeModules, CompilerParameters options, ErrorContext errorContext, AppDomain compilationTempAppDomain)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at Microsoft.ReportingServices.ReportProcessing.ReportCompileTime.InternalCompile(Report report, AppDomain compilationTempAppDomain, Boolean refusePermissions)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at Microsoft.ReportingServices.ReportProcessing.ReportCompileTime.Compile(Report report, AppDomain compilationTempAppDomain, Boolean refusePermissions)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at Microsoft.ReportingServices.ReportProcessing.ReportPublishing.Phase3(ParameterInfoCollection&amp;amp; parameters, AppDomain compilationTempAppDomain, Boolean generateExpressionHostWithRefusedPermissions)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at Microsoft.ReportingServices.ReportProcessing.ReportPublishing.CreateIntermediateFormat(CatalogItemContext reportContext, Byte[] definition, CreateReportChunk createChunkCallback, CheckSharedDataSource checkDataSourceCallback, PublishingErrorContext errorContext, AppDomain compilationTempAppDomain, Boolean generateExpressionHostWithRefusedPermissions, String&amp;amp; description, String&amp;amp; language, ParameterInfoCollection&amp;amp; parameters, DataSourceInfoCollection&amp;amp; dataSources, UserLocationFlags&amp;amp; userReferenceLocation, ArrayList&amp;amp; dataSetsName, Boolean&amp;amp; hasExternalImages, Boolean&amp;amp; hasHyperlinks)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.CompileReport(CatalogItemContext reportContext, Byte[] reportDefinition, CreateReportChunk createChunkCallback, CheckSharedDataSource checkDataSourceCallback, PublishingErrorContext errorContext, AppDomain compilationTempAppDomain, Boolean generateExpressionHostWithRefusedPermissions, String&amp;amp; reportDescription, String&amp;amp; reportLanguage, ParameterInfoCollection&amp;amp; parameters, DataSourceInfoCollection&amp;amp; dataSources, UserLocationFlags&amp;amp; userReferenceLocation, ArrayList&amp;amp; dataSetsName, Boolean&amp;amp; hasExternalImages, Boolean&amp;amp; hasHyperlinks)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.CreateIntermediateFormat(CatalogItemContext reportContext, Byte[] reportDefinition, CreateReportChunk createChunkCallback, CheckSharedDataSource checkDataSourceCallback, AppDomain compilationTempAppDomain, Boolean generateExpressionHostWithRefusedPermissions)&lt;/p&gt;
&lt;p&gt;The action that failed was:&lt;/p&gt;
&lt;p&gt;Demand&lt;/p&gt;
&lt;p&gt;The type of the first permission that failed was:&lt;/p&gt;
&lt;p&gt;System.Security.Permissions.FileIOPermission&lt;/p&gt;
&lt;p&gt;The first permission that failed was:&lt;/p&gt;
&lt;p&gt;&amp;lt;IPermission class=&amp;quot;System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&amp;quot;&lt;/p&gt;
&lt;p&gt;version=&amp;quot;1&amp;quot;&lt;/p&gt;
&lt;p&gt;Read=&amp;quot;C:\WINDOWS\assembly\GAC_MSIL\Microsoft.ReportViewer.Common\8.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.Common.dll&amp;quot;&lt;/p&gt;
&lt;p&gt;PathDiscovery=&amp;quot;C:\WINDOWS\assembly\GAC_MSIL\Microsoft.ReportViewer.Common\8.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.Common.dll&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt;The demand was for:&lt;/p&gt;
&lt;p&gt;&amp;lt;IPermission class=&amp;quot;System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&amp;quot;&lt;/p&gt;
&lt;p&gt;version=&amp;quot;1&amp;quot;&lt;/p&gt;
&lt;p&gt;Read=&amp;quot;C:\WINDOWS\assembly\GAC_MSIL\Microsoft.ReportViewer.Common\8.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.Common.dll&amp;quot;&lt;/p&gt;
&lt;p&gt;PathDiscovery=&amp;quot;C:\WINDOWS\assembly\GAC_MSIL\Microsoft.ReportViewer.Common\8.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.Common.dll&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt;The granted set of the failing assembly was:&lt;/p&gt;
&lt;p&gt;&amp;lt;PermissionSet class=&amp;quot;System.Security.PermissionSet&amp;quot;&lt;/p&gt;
&lt;p&gt;version=&amp;quot;1&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;IPermission class=&amp;quot;System.Security.Permissions.FileDialogPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&amp;quot;&lt;/p&gt;
&lt;p&gt;version=&amp;quot;1&amp;quot;&lt;/p&gt;
&lt;p&gt;Access=&amp;quot;Open&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;IPermission class=&amp;quot;System.Security.Permissions.IsolatedStorageFilePermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&amp;quot;&lt;/p&gt;
&lt;p&gt;version=&amp;quot;1&amp;quot;&lt;/p&gt;
&lt;p&gt;Allowed=&amp;quot;ApplicationIsolationByUser&amp;quot;&lt;/p&gt;
&lt;p&gt;UserQuota=&amp;quot;512000&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;IPermission class=&amp;quot;System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&amp;quot;&lt;/p&gt;
&lt;p&gt;version=&amp;quot;1&amp;quot;&lt;/p&gt;
&lt;p&gt;Flags=&amp;quot;Execution&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;IPermission class=&amp;quot;System.Security.Permissions.UIPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&amp;quot;&lt;/p&gt;
&lt;p&gt;version=&amp;quot;1&amp;quot;&lt;/p&gt;
&lt;p&gt;Window=&amp;quot;SafeTopLevelWindows&amp;quot;&lt;/p&gt;
&lt;p&gt;Clipboard=&amp;quot;OwnClipboard&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;IPermission class=&amp;quot;System.Security.Permissions.SiteIdentityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&amp;quot;&lt;/p&gt;
&lt;p&gt;version=&amp;quot;1&amp;quot;&lt;/p&gt;
&lt;p&gt;Site=&amp;quot;tempuri.org&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;IPermission class=&amp;quot;System.Security.Permissions.StrongNameIdentityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&amp;quot;&lt;/p&gt;
&lt;p&gt;version=&amp;quot;1&amp;quot;&lt;/p&gt;
&lt;p&gt;PublicKeyBlob=&amp;quot;0000000000000000&amp;quot;&lt;/p&gt;
&lt;p&gt;Name=&amp;quot;AdminUnit.application&amp;quot;&lt;/p&gt;
&lt;p&gt;AssemblyVersion=&amp;quot;1.0.0.19&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;IPermission class=&amp;quot;System.Security.Permissions.UrlIdentityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&amp;quot;&lt;/p&gt;
&lt;p&gt;version=&amp;quot;1&amp;quot;&lt;/p&gt;
&lt;p&gt;Url=&amp;quot;&lt;a rel="nofollow" target="_new" href="http://tempuri.org/AdminUnit.application&amp;quot;/&amp;gt;"&gt;http://tempuri.org/AdminUnit.application&amp;quot;/&amp;gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;IPermission class=&amp;quot;System.Security.Permissions.ZoneIdentityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&amp;quot;&lt;/p&gt;
&lt;p&gt;version=&amp;quot;1&amp;quot;&lt;/p&gt;
&lt;p&gt;Zone=&amp;quot;Internet&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;IPermission class=&amp;quot;System.Drawing.Printing.PrintingPermission, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&amp;quot;&lt;/p&gt;
&lt;p&gt;version=&amp;quot;1&amp;quot;&lt;/p&gt;
&lt;p&gt;Level=&amp;quot;SafePrinting&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;IPermission class=&amp;quot;System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&amp;quot;&lt;/p&gt;
&lt;p&gt;version=&amp;quot;1&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;ConnectAccess&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;URI uri=&amp;quot;(http|https)://tempuri\.org/.*&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;/ConnectAccess&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;/IPermission&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;/PermissionSet&amp;gt;&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#789596</link><pubDate>Wed, 04 Oct 2006 15:48:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:789596</guid><dc:creator>Jelle</dc:creator><description>&lt;p&gt;it seems that I have my report viewer installed on D: and not in C: so in the C:\windows\assembly where report viewer is looking by default is maybe the problem. How do I move my reportviewer to the GAC of the C?&lt;/p&gt;
</description></item><item><title>Solution to fileio permission</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#789921</link><pubDate>Wed, 04 Oct 2006 18:05:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:789921</guid><dc:creator>Jelle</dc:creator><description>&lt;p&gt;You have to provide the right path to the report:&lt;/p&gt;
&lt;p&gt;this.Viewer.LocalReport.ReportPath = Environment.CurrentDirectory + @&amp;quot;\&amp;quot; + reportToLoad + &amp;quot;.rdlc&amp;quot;;&lt;/p&gt;
&lt;p&gt; this.Viewer.ProcessingMode = ProcessingMode.Local;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.Viewer.LocalReport.ExecuteReportInCurrentAppDomain(AppDomain.CurrentDomain.Evidence);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.Viewer.LocalReport.ReportPath = Environment.CurrentDirectory + @&amp;quot;\&amp;quot; + reportToLoad + &amp;quot;.rdlc&amp;quot;;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;FileIOPermission filePerm = new FileIOPermission(FileIOPermissionAccess.Read, this.Viewer.LocalReport.ReportPath);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;filePerm.Assert();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.Viewer.LocalReport.AddTrustedCodeModuleInCurrentAppDomain(System.Reflection.Assembly.GetAssembly(typeof(GDS.User.WinLanguage)).FullName);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.Viewer.LocalReport.DataSources.Clear();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;foreach (System.Data.DataTable _dataTable in ReportDataSet.Tables)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.Viewer.LocalReport.DataSources.Add(&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;new ReportDataSource(ReportDataSet.DataSetName + &amp;quot;_&amp;quot; + _dataTable.TableName, _dataTable));&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#870551</link><pubDate>Wed, 25 Oct 2006 01:36:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:870551</guid><dc:creator>Davide Senatore</dc:creator><description>&lt;p&gt;Great article!!! A very good exam of an interesting and very useful tool... Thank you!!!&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#879852</link><pubDate>Fri, 27 Oct 2006 15:42:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:879852</guid><dc:creator>Sebastian</dc:creator><description>&lt;p&gt;Great post!, but what about localization? How can I localize my column headers?&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#1108721</link><pubDate>Mon, 20 Nov 2006 16:06:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1108721</guid><dc:creator>Pradeep</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;I have a problem in Printing Report from ReportViewer. If I print the report, when it is in NORMAL LAYOUT...it is not getting printed. But if I print the same by setting PRINT LAYOUT...coming good.&lt;/p&gt;
&lt;p&gt;Is there any way to show the report in PRINT LAYOUT by default? OR Is there any way to set the LAYOUT mode programaticaly?&lt;/p&gt;
&lt;p&gt;Thank you&lt;/p&gt;
&lt;p&gt;Pradeep.&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#1347626</link><pubDate>Fri, 22 Dec 2006 16:14:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1347626</guid><dc:creator>Bruno</dc:creator><description>&lt;p&gt;This worked fine for me untill I installed the SP1 for Visual Studio. Now I got back the &amp;quot;Error while loading code module: ‘ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’. Details: Could not load file or assembly 'ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.&amp;quot;-Error. I am still investigating. Any soloution?&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#1410936</link><pubDate>Thu, 04 Jan 2007 17:45:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1410936</guid><dc:creator>Gancy</dc:creator><description>&lt;p&gt;Very nice article. &amp;nbsp;But I need to know how to use custom assemblies on web based report rendering. &amp;nbsp;My custom assembly need to access reportserver.exe.config file, which result sin FileIO security exception. &amp;nbsp;I am sure some one must have done this before. &amp;nbsp;&lt;/p&gt;
</description></item><item><title>F*cking VS2005 SP1</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#1566794</link><pubDate>Wed, 31 Jan 2007 22:22:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1566794</guid><dc:creator>Sebastian</dc:creator><description>&lt;p&gt;Hey dude, great article.&lt;/p&gt;
&lt;p&gt;For those having the &amp;quot;Error while loading code module:&amp;quot; error in web applications, try installing VS2005 SP1. But after that you win reports projects will have that error according to this:&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1099668&amp;amp;SiteID=1"&gt;http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1099668&amp;amp;SiteID=1&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Still looking for the solution...&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#1670092</link><pubDate>Tue, 13 Feb 2007 19:55:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1670092</guid><dc:creator>M$</dc:creator><description>&lt;p&gt;Is it possible to convert rdl to rdlc and render the report at run time ?&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#1670353</link><pubDate>Tue, 13 Feb 2007 21:05:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1670353</guid><dc:creator>M$</dc:creator><description>&lt;p&gt;Is this the only way to convert RDL to RDLC and could this be done at run-time ?&lt;/p&gt;
&lt;p&gt;RDL-to-RDLC Conversion&lt;/p&gt;
&lt;p&gt;When converting a .rdl file to .rdlc format, you must manually replace the data source and query information in the report definition with data constructs provided in your application.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; 1.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Rename the .rdl file to use the .rdlc file extension.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; 2.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;In Visual Studio 2005, open the solution or project that will contain the report.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; 3.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Create or add the dataset that defines the data you want to use to your projector solution. For more information, see Creating Data Sources for a ReportViewer Report.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; 4.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;On the Project menu, click Add Existing Item and then select the .rdlc file that you created in the first step.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; 5.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;In the project, open the form or Web page that will contain the report.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; 6.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;From the Toolbox, in the Data group, drag a ReportViewer control onto the form or Web page.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; 7.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;In the ReportViewer Tasks smart tags panel, in Choose Reports, select the .rdlc file to use with the control.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; 8.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;In the ReportViewer Tasks smart tags panel, in Choose Data Sources, select the dataset you want to use. The dataset object, binding source object, and table object will appear at the bottom of the workspace. For more information about updating data source references, see Updating and Rebinding Data Source References.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; 9.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Save all files, and then build or deploy the project to verify that the report contains the data you expect.&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#1718004</link><pubDate>Mon, 19 Feb 2007 22:16:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1718004</guid><dc:creator>Vikas</dc:creator><description>&lt;p&gt;If you are trying to access a custom assembly code in the reports and if you are getting the following error.&lt;/p&gt;
&lt;p&gt;Error while loading code module: ‘ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’. Details: Could not load file or assembly 'ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.&lt;/p&gt;
&lt;p&gt; &amp;nbsp;Then copy the Custom Assembly dll into the following folder.&lt;/p&gt;
&lt;p&gt;PROGRAMFILES\Visual Studio 8\Common7\IDE\PublicAssemblies&lt;/p&gt;
&lt;p&gt;See the following post for more details.&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1099668&amp;amp;SiteID=1"&gt;http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1099668&amp;amp;SiteID=1&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Good Post Mohamed :-)&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#1748193</link><pubDate>Fri, 23 Feb 2007 20:03:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1748193</guid><dc:creator>Bogdan</dc:creator><description>&lt;p&gt;Great article!&lt;/p&gt;
&lt;p&gt;This report control is a mess and it feels just like no more than an “idea”.&lt;/p&gt;
&lt;p&gt;Thanks to this article and all comments I finally managed to run something...&lt;/p&gt;
&lt;p&gt;Here are few pointers for those trying to display images from DB on the report.&lt;/p&gt;
&lt;p&gt;In my example I used Categories table from Northwind DB &lt;/p&gt;
&lt;p&gt;Image control available for the report control needs raw bytes to be passed in Value property.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Note: System.Windows.Forms.PictureBox.Image property uses Image class.&lt;/p&gt;
&lt;p&gt;Image.MIMEType=image/bmp&lt;/p&gt;
&lt;p&gt;Image.Source=Database&lt;/p&gt;
&lt;p&gt;Image.Value=Utils.Utils.GetRawBytes(Fields!Picture.Value)&lt;/p&gt;
&lt;p&gt;Where GetRawBytes() is a static method in a referenced assembly Utils&lt;/p&gt;
&lt;p&gt;using System;&lt;/p&gt;
&lt;p&gt;using System.Drawing;&lt;/p&gt;
&lt;p&gt;using System.IO;&lt;/p&gt;
&lt;p&gt;using System.Configuration;&lt;/p&gt;
&lt;p&gt;namespace Utils&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;public class Utils&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;public static byte[] GetRawBytes(byte[] bytes)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// remove OLE header if present&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;MemoryStream ms = null;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;try&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;int offset = 0;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // use offset=78 for Northwind DB&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (ConfigurationManager.AppSettings[&amp;quot;ImageOffset&amp;quot;].ToString().Length &amp;gt; 0)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;offset = Convert.ToInt32(ConfigurationManager.AppSettings[&amp;quot;ImageOffset&amp;quot;]);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (offset &amp;gt; 0)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ms = new MemoryStream(bytes, offset, bytes.Length - offset);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;bytes = ms.ToArray();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;catch (Exception ex)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Console.WriteLine(ex.Message);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;finally&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (ms != null)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ms.Close();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ms = null;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return bytes;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
</description></item><item><title>Print button is not visible when i use rdl files as local reports </title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#2030753</link><pubDate>Thu, 05 Apr 2007 10:20:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2030753</guid><dc:creator>Suri</dc:creator><description>&lt;p&gt;Print button is not visible when i use rdl files as local reports through report viewer.&lt;/p&gt;
&lt;p&gt;Print button is not displaying and only two types of export options.&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#2157887</link><pubDate>Tue, 17 Apr 2007 01:53:21 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2157887</guid><dc:creator>Pete</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Just sharing a &amp;quot;feature&amp;quot; on winform reportviewer which did cost a day to figure out:&lt;/p&gt;
&lt;p&gt;I got &amp;quot;Some parameters or crednetials have not been specified&amp;quot;. Strange thing, I did not get them when running through visual studio (either debug or release), but ONLY when run apart from VS. (go figure that one).&lt;/p&gt;
&lt;p&gt;After working through tips here on the site, THANKS, &amp;nbsp;(a few I discovered the &amp;quot;hard way&amp;quot; already), I finally figured it and just wanted to share:&lt;/p&gt;
&lt;p&gt;First do a localreport refresh, than the viewer itself:&lt;/p&gt;
&lt;p&gt; reportViewer1.LocalReport.Refresh();&lt;/p&gt;
&lt;p&gt; reportViewer1.RefreshReport();&lt;/p&gt;
&lt;p&gt;For some reason I had it the other way around, resulting in that mysterious error, but not within VS environment.&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Pieter&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#2158428</link><pubDate>Tue, 17 Apr 2007 03:24:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2158428</guid><dc:creator>Shane</dc:creator><description>&lt;p&gt;Thanks for the post. &amp;nbsp;What you can also do is add the copying of the dll to the PublicAssemblies folder to the post build event for the assembly in your code so you don't have to remember to do it after each build. &amp;nbsp;e.g.&lt;/p&gt;
&lt;p&gt;copy E:\projects\vsdev\&amp;lt;project&amp;gt;\Common\bin\Debug\Project.Common.dll &amp;quot;C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\IDE\PublicAssemblies&amp;quot;&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#3101470</link><pubDate>Tue, 05 Jun 2007 21:50:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3101470</guid><dc:creator>John</dc:creator><description>&lt;p&gt;How do you format Boolean columns to display a checkbox?&lt;/p&gt;
</description></item><item><title>How do you format Boolean columns to display a checkbox?</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#3519501</link><pubDate>Mon, 25 Jun 2007 15:59:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3519501</guid><dc:creator>Monika Aleksieva</dc:creator><description>&lt;p&gt;John,&lt;/p&gt;
&lt;p&gt;You cannot display checkboxes. If you want to display boolean columns, you can add an image and specify image path depending on the value of your data. For example 1.gif (true) and 0.gif (false) can look like a box with or without a tick.&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#3520242</link><pubDate>Mon, 25 Jun 2007 16:57:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3520242</guid><dc:creator>Monika Aleksieva</dc:creator><description>&lt;p&gt;For web apps to work with local reports and custom assemblies that are NOT installed in GAC, you have to run Microsoft Report Viewer Redistributable 2005 SP1. This is available here - &lt;a rel="nofollow" target="_new" href="http://www.microsoft.com/downloads/details.aspx?FamilyId=35F23B3C-3B3F-4377-9AE1-26321F99FDF0&amp;amp;displaylang=en"&gt;http://www.microsoft.com/downloads/details.aspx?FamilyId=35F23B3C-3B3F-4377-9AE1-26321F99FDF0&amp;amp;displaylang=en&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#3552227</link><pubDate>Tue, 26 Jun 2007 23:38:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3552227</guid><dc:creator>John</dc:creator><description>&lt;p&gt;I have a formula for column called %Diff to Goal&lt;/p&gt;
&lt;p&gt;=Iif(Fields!ThisYearActual.Value &amp;gt; 0 And Fields!ThisYearGoal.Value &amp;gt; 0,( (Fields!ThisYearActual.Value &amp;nbsp;- &amp;nbsp; Fields!ThisYearGoal.Value) / &amp;nbsp;Fields!ThisYearGoal.Value), 0 )&lt;/p&gt;
&lt;p&gt;What I really want is to check for values greater than NULL, but used &amp;quot;&amp;gt; 0&amp;quot; instead.&lt;/p&gt;
&lt;p&gt;But I do not see any options in the Edit Expression dialog box to check for Null values.&lt;/p&gt;
&lt;p&gt;At the moment, if ThisYearActual is &amp;gt; 0, but ThisYearGoal is Null, the ‘% Diff to Goal’ is displaying an ‘#Error’ message.&lt;/p&gt;
&lt;p&gt;Is there a better way to write this formula, and/or check for null values?&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#3564042</link><pubDate>Wed, 27 Jun 2007 14:39:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3564042</guid><dc:creator>Tom</dc:creator><description>&lt;p&gt;I have a report that is part of my project (is not in a DLL) so is there a way to access textboxes that I've placed on the report to populate with a value? &amp;nbsp;Or do I need to put my report in a seperate DLL?&lt;/p&gt;
&lt;p&gt;I guess the part that is confusing me is when you browse to add a reference.....is this referring to the fact that the report is in a DLL?&lt;/p&gt;
&lt;p&gt;Thanks and great blog&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#3656327</link><pubDate>Mon, 02 Jul 2007 09:12:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3656327</guid><dc:creator>Di</dc:creator><description>&lt;p&gt;I have a problem with deploying reports from Visual Studio where it is remembering an old user name to try to use for deploying - it does not have sufficient permissions. &amp;nbsp;Do you know how to force it to prompt for a user? &amp;nbsp; For deploying, we only need to supply a URL in the project properties. &lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#3781278</link><pubDate>Mon, 09 Jul 2007 16:07:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3781278</guid><dc:creator>Di</dc:creator><description>&lt;p&gt;Excellent -solved my problem with the error.However, I am trying to use the custom code to create a comma delimited list of values from the row values in a table. I get the list accummulating correctly till the group footer where the list value is then empty. &amp;nbsp;The list is accummulated within my external class using calls on the detail line of the table.&lt;/p&gt;
&lt;p&gt;It appears that there is a separate instance being used for the level 1 grouper from the detail line grouper and thus when I call my external class to get the accumulated value, the result is empty.&lt;/p&gt;
&lt;p&gt;Any suggestions on how to overcome this would be greatly appreciated.&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#4041280</link><pubDate>Wed, 25 Jul 2007 13:51:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4041280</guid><dc:creator>Anthony Manvell</dc:creator><description>&lt;p&gt;Excellent, concise article. Very informative will save me hours of investigation. Many thanks.&lt;/p&gt;
</description></item><item><title>How do you format Boolean columns to display a checkbox?</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#4366848</link><pubDate>Mon, 13 Aug 2007 14:28:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4366848</guid><dc:creator>VinK</dc:creator><description>&lt;p&gt;Displaying checkboxes in microsoft reports is very simple and an interesting method can be found right here&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://www.xhydra.com/dotnet/displaying-checkboxes-in-microsoft-reports.html"&gt;http://www.xhydra.com/dotnet/displaying-checkboxes-in-microsoft-reports.html&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#4496477</link><pubDate>Tue, 21 Aug 2007 20:14:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4496477</guid><dc:creator>dshah</dc:creator><description>&lt;p&gt;Thanks for this amazing blog.. i have visited this blog for the first time and I am fan of it now. This article is amazing.&lt;/p&gt;
&lt;p&gt;Thank you so much.&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#4647863</link><pubDate>Thu, 30 Aug 2007 17:18:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4647863</guid><dc:creator>Samee Qayum</dc:creator><description>&lt;p&gt;AS,&lt;/p&gt;
&lt;p&gt;I have used your solution but the problem of adding a data source name was not included - had to get from MS support.&lt;/p&gt;
&lt;p&gt;I still have the problem: &lt;/p&gt;
&lt;p&gt;T&amp;quot;he report references the code module 'System.Windows.Forms', which is not trusted&amp;quot;&lt;/p&gt;
&lt;p&gt;Can you help ?&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Samee Qayum&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#5009607</link><pubDate>Thu, 20 Sep 2007 12:37:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5009607</guid><dc:creator>alexjoei</dc:creator><description>&lt;p&gt;Hello, good article, but i have donde all hte steps, and i still have the: &lt;/p&gt;
&lt;p&gt; &amp;quot;The report references the code module ‘System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’, which is not a trusted assembly&amp;quot;.&lt;/p&gt;
&lt;p&gt;I have a report that in the 'Code' has a function that uses system.drawing, i write in my load event the two lines (AddTrustedCodeModuleInCurrentAppDomain, ExecuteReportInCurrentAppDomain)&lt;/p&gt;
&lt;p&gt; but it dont solves my problem,&lt;/p&gt;
&lt;p&gt;any idea please??&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#5144031</link><pubDate>Wed, 26 Sep 2007 16:10:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5144031</guid><dc:creator>Cesar</dc:creator><description>&lt;p&gt;Really thanks for this useful blog!! ^^&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#5144072</link><pubDate>Wed, 26 Sep 2007 16:13:18 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5144072</guid><dc:creator>Cesar</dc:creator><description>&lt;p&gt;And, ah. If you still are running problems with &amp;quot;no permission&amp;quot; message event after adding the AddTrustedCodeModuleInCurrentAppDomain and ExecuteReportInCurrentAppDomain, the error was gone when I inverted the order. So, you need to execute ExecuteReportInCurrentAppDomain first, then AddTrustedCodeModuleInCurrentAppDomain.&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#5271621</link><pubDate>Thu, 04 Oct 2007 08:53:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5271621</guid><dc:creator>Michael C</dc:creator><description>&lt;p&gt;And that does it!! Thanks Ceasar. &amp;nbsp;I inverted the AddTrustedCodeModuleInCurrentAppDomain and ExecuteReportInCurrentAppDomain and there you have it, my barcode generation code loaded. &amp;nbsp;Now just to get it to format the datastream.&lt;/p&gt;
&lt;p&gt;Now I have a solution to replace lovely Crystal Reports.&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#5462298</link><pubDate>Mon, 15 Oct 2007 18:25:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5462298</guid><dc:creator>jim hudson</dc:creator><description>&lt;p&gt;mohammed, you are the man. ever think about writing a book ;)&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#5522969</link><pubDate>Fri, 19 Oct 2007 15:33:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5522969</guid><dc:creator>Ravi</dc:creator><description>&lt;p&gt;Hi...&lt;/p&gt;
&lt;p&gt;I am having a report name &amp;quot;Report1.rdlc&amp;quot;&lt;/p&gt;
&lt;p&gt;Now,I want to add a textbox at runtime...How can i??&lt;/p&gt;
&lt;p&gt;Thanks in advance&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#6664949</link><pubDate>Wed, 05 Dec 2007 13:31:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6664949</guid><dc:creator>mojtaba</dc:creator><description>&lt;p&gt;Thank For Your Try And Soloution...&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#7208002</link><pubDate>Wed, 23 Jan 2008 15:17:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7208002</guid><dc:creator>Pooya Davoodi</dc:creator><description>&lt;p&gt;I found a way to deal with the problem that Raja says above at:&lt;/p&gt;
&lt;p&gt;&amp;quot;&lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#606223&amp;quot;"&gt;http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#606223&amp;quot;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;After a lot of checking, at last I found out that if you disable the &amp;quot;ClickOnce Security Settings&amp;quot; from the security section of properties of your project, it works fine. I don't know exactly why, but it works.&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#7208026</link><pubDate>Wed, 23 Jan 2008 15:20:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7208026</guid><dc:creator>Pooya Davoodi</dc:creator><description>&lt;p&gt;sorry, in the previous comment that I posted, I typed an extra double quotation at the end of the link.&lt;/p&gt;
</description></item><item><title>Report Preprocessing: SQL Server Reporting Server Group PageTotals Walkthrough, Part I: the RDL and the Server</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#7992156</link><pubDate>Sun, 02 Mar 2008 21:47:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7992156</guid><dc:creator>TechSpoken</dc:creator><description>&lt;p&gt;Report Preprocessing: SQL Server Reporting Server Group PageTotals Walkthrough, Part I: the RDL and the Server&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#8310917</link><pubDate>Tue, 18 Mar 2008 12:20:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8310917</guid><dc:creator>sunu</dc:creator><description>&lt;p&gt;i have created a report rdlc and got connection to the database .... the databse has only two columns fname and lname...&lt;/p&gt;
&lt;p&gt;the query in the table adapter is:&lt;/p&gt;
&lt;p&gt;SELECT fname, lname FROM dbo.sunu &amp;nbsp;where lname=@lastname&lt;/p&gt;
&lt;p&gt;i have set a report parameter &amp;quot;lastname&amp;quot; also ..&lt;/p&gt;
&lt;p&gt;i have passed the parameter value as &amp;quot;s&amp;quot; through the set parameter method and obtained it in the report also as i can see the parameter printed on my report when it is rendered...&lt;/p&gt;
&lt;p&gt;but the data is not filtered based on lname=&amp;quot;s&amp;quot;??&lt;/p&gt;
&lt;p&gt;any ideas as to what i am doing wrong??&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#8313168</link><pubDate>Tue, 18 Mar 2008 14:32:07 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8313168</guid><dc:creator>sunju</dc:creator><description>&lt;p&gt;one more thing .. iam not using reportviewer instead i am directly writing the report to a file &lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#8351024</link><pubDate>Wed, 02 Apr 2008 15:28:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8351024</guid><dc:creator>Smith</dc:creator><description>&lt;p&gt;When i try to use your function toUpperCase i get the following error message: &lt;/p&gt;
&lt;p&gt;An error occurred during local report processing. Failed to load expression host assembly. Details: Parameter count mismatch. &lt;/p&gt;
&lt;p&gt;I double checked the parameters i`m passing to the method and cannot figure out where is the problem. &lt;/p&gt;
&lt;p&gt;Even on the most simple example like =Code.toUpperCase(&amp;quot;aaa&amp;quot;) i get the same message!&lt;/p&gt;
&lt;p&gt;Can you please give me some clue? &lt;/p&gt;
</description></item><item><title>how to display subtotal of previous page in the top of next page in rdlc report.</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#8421106</link><pubDate>Thu, 24 Apr 2008 11:06:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8421106</guid><dc:creator>uma</dc:creator><description>&lt;p&gt;hi how to display subtotal of previous page in the top of next page in rdlc report.&lt;/p&gt;
&lt;p&gt;Ex:&lt;/p&gt;
&lt;p&gt;page 1&lt;/p&gt;
&lt;p&gt;name acc bal&lt;/p&gt;
&lt;p&gt;a &amp;nbsp; &amp;nbsp;6 &amp;nbsp; &amp;nbsp;10&lt;/p&gt;
&lt;p&gt;b &amp;nbsp; &amp;nbsp; 7 &amp;nbsp; &amp;nbsp;20&lt;/p&gt;
&lt;p&gt;sutotal &amp;nbsp; &amp;nbsp;30&lt;/p&gt;
&lt;p&gt;page 2&lt;/p&gt;
&lt;p&gt;subtotal of first page 30&lt;/p&gt;
&lt;p&gt;name acc bal&lt;/p&gt;
&lt;p&gt;aa &amp;nbsp; &amp;nbsp;6 &amp;nbsp; &amp;nbsp;10&lt;/p&gt;
&lt;p&gt;bb &amp;nbsp; &amp;nbsp; 9 &amp;nbsp; &amp;nbsp;60&lt;/p&gt;
&lt;p&gt;sutotal &amp;nbsp; &amp;nbsp;70&lt;/p&gt;
&lt;p&gt;page 3&lt;/p&gt;
&lt;p&gt;subtotal of second page 30&lt;/p&gt;
&lt;p&gt;can anyone plz.. help me its urgent.&lt;/p&gt;
&lt;p&gt;Thanks in advance,&lt;/p&gt;
&lt;p&gt;uma&lt;/p&gt;
</description></item><item><title>Reference custom code assembly in ReportViewer control</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#8435839</link><pubDate>Mon, 28 Apr 2008 21:10:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8435839</guid><dc:creator>Expecho's .Net corner</dc:creator><description>&lt;p&gt;Reference custom code assembly in ReportViewer control&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#8460119</link><pubDate>Mon, 05 May 2008 12:54:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8460119</guid><dc:creator>uma</dc:creator><description>&lt;p&gt;hi i am using this custom code to display subtotal of first page in the next page &lt;/p&gt;
&lt;p&gt; &amp;nbsp;Public Double &amp;nbsp;P=0&lt;/p&gt;
&lt;p&gt; &amp;nbsp;Public String Myfun(Double t)&lt;/p&gt;
&lt;p&gt; {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; P=t&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; Return &amp;nbsp;P&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt;and i am calling this fun in text box&lt;/p&gt;
&lt;p&gt;=Code.Myfun(Sum(Fields!OrderID.Value.ToString))&lt;/p&gt;
&lt;p&gt;=IIF(Code.P = 0,&amp;quot;&amp;quot;,Code.P)&lt;/p&gt;
&lt;p&gt;but its giving these &amp;nbsp;errors &lt;/p&gt;
&lt;p&gt; Error	1	There is an error on line 1 of custom code: [BC30183] Keyword is not valid as an identifier.	C:\Inetpub\wwwroot\WebSite5\Report.rdlc	1	&lt;/p&gt;
&lt;p&gt;Error	2	The Value expression for the textbox ‘OrderID_2’ contains an error: [BC30456] 'Myfun' is not a member of 'ReportExprHostImpl.CustomCodeProxy'.	C:\Inetpub\wwwroot\WebSite5\Report.rdlc	1	&lt;/p&gt;
&lt;p&gt;Error	3	The Value expression for the textbox ‘textbox13’ contains an error: [BC30456] 'P' is not a member of 'ReportExprHostImpl.CustomCodeProxy'.	C:\Inetpub\wwwroot\WebSite5\Report.rdlc	1	&lt;/p&gt;
&lt;p&gt;plz.. anyone can help me.&lt;/p&gt;
&lt;p&gt;thanks&lt;/p&gt;
&lt;p&gt;uma&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#8575306</link><pubDate>Thu, 05 Jun 2008 16:53:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8575306</guid><dc:creator>jemacc</dc:creator><description>&lt;p&gt;I am trying to add code to &amp;nbsp;to my report. I am not very familiar with referencing the assembly. &amp;nbsp;With the following code can you point me in the right direction as to how I would refrence the assembly and classes&lt;/p&gt;
&lt;p&gt;Function SetLanguage(ByVal value AS Object) As Object&lt;/p&gt;
&lt;p&gt;	If value = &amp;quot;EUR&amp;quot; &amp;nbsp;&lt;/p&gt;
&lt;p&gt;		Return &amp;quot;French&amp;quot;&lt;/p&gt;
&lt;p&gt;	ElseIf value = &amp;quot;GBP&amp;quot; &lt;/p&gt;
&lt;p&gt;		 Return &amp;nbsp;&amp;quot;French&amp;quot;&lt;/p&gt;
&lt;p&gt;	Else &lt;/p&gt;
&lt;p&gt;		 Return &amp;quot;French&amp;quot;&lt;/p&gt;
&lt;p&gt;	End If	&lt;/p&gt;
&lt;p&gt;End Function&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#8802151</link><pubDate>Sat, 02 Aug 2008 00:03:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8802151</guid><dc:creator>Chris Forbes</dc:creator><description>&lt;p&gt;Embedded or local reports: I shall test this in a WinForm application, but I can not get the report engine to see, &amp;quot;find&amp;quot;, &amp;nbsp;a private assembly using the ReportViewer control and a local report (.rdlc) in a web application using SQLExpress unless I put the assembly into C:\Windows\Microsoft.Net\framework\v2.0.50727\MyTestAssembly.dll (for example). &amp;nbsp;I have tried all of the above lines of code in my on_load routine and while the permissions problem is solved, finding the library is not, or at least not for web apps.&lt;/p&gt;
&lt;p&gt;If the system directory, .../v2.0.50727, is the only way, it won't fly. &amp;nbsp;System admins would have tripple kittens and frankly, I wouldn't blame them. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Also, it would be of very limited use to build libraries of functionality that could be used by Reports in WinForm applications, but not in Web applications.&lt;/p&gt;
&lt;p&gt;If there is a way to inform the Report engine from a web app where to look for the dll (it's plumb crazy that it doesn't at least look in current directory), I would love to hear about it. &amp;nbsp;Having said that, great blog! &amp;nbsp;Even the books I can find don't go into this much detail.&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#8905099</link><pubDate>Fri, 29 Aug 2008 16:56:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8905099</guid><dc:creator>AAA</dc:creator><description>&lt;p&gt;Do you know how to refer to the report parameters in the custom code &lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#8933004</link><pubDate>Mon, 08 Sep 2008 15:09:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8933004</guid><dc:creator>Dilip M.D</dc:creator><description>&lt;p&gt;It worked for me with just first step. Thanks Mohamed.&lt;/p&gt;
</description></item><item><title>re: Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#8951208</link><pubDate>Sun, 14 Sep 2008 01:44:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8951208</guid><dc:creator>Paul M. Allen</dc:creator><description>&lt;p&gt;Re: your blog - good stuff!&lt;/p&gt;
&lt;p&gt;I am just getting into Microsoft Reports, initially doing reports for display in a reportviewer and using local mode rather than a server as part of a billing system I am building in VS2005 - the objective was to find a way to avoid endless hours of typing printdocument code and to take advantage of the &lt;/p&gt;
&lt;p&gt;PDF/Excel export feature. The learning curve got pretty steep when I started to do a report that would generate an invoice.&lt;/p&gt;
&lt;p&gt;Part of the complexity is due to the fact that the viewer will be used to display multiple reports.&lt;/p&gt;
&lt;p&gt;Hopefully the following code (triggered when a selection is made from a listbox) will be helpful in giving others who might be trying to do something similar not necessarily answers but instead insights into the process.&lt;/p&gt;
&lt;p&gt;There is a well documented problem when printing with the 2005 viewer. On some &lt;/p&gt;
&lt;p&gt;printers - including both my Canon printers - the margins get messed up unless &lt;/p&gt;
&lt;p&gt;the margins are set to .5in or more. The easy solution is to just set the margins &lt;/p&gt;
&lt;p&gt;to .5in and accept the fact that they're wider than we'd prefer.&lt;/p&gt;
&lt;p&gt;I would agree with the observation that Reports and the Reportviewer are works in progress but that seems to be the case with lots of Microsoft stuff - seems like whenever we want to do something that goes beyond basic functionality that things get ugly. I wonder if any of the people who develop things there ever try to put them to use in the real world.&lt;/p&gt;
&lt;p&gt;My comments in the code are notes to myself to remind me what I did and why.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;switch (listBoxReportList.Text.ToString())&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //You have to manually set the datasource when doing the subreport as below&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//We want to display different reports in the same report viewer.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//The tricky part is that we build the reports in the development environment&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//using the PMABillingDataSet but the program actually uses an instance of it called pmaBillingDataSet1.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//After we've built the report, the we need to go into the rdlc file code for the report using the XML editor&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//and change the PMABillingDataSet references to pmaBillingDataSet1 to get the thing to work.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Perhaps the answer is to pass the datasetname as a parameter.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//In the report viewer, we can't use embedded resource value because it would lock in the data source so we need to use &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//file path to get the report. In the development environment, the path is \bin\debug\Reports\.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//In the code below, note that the datasource(ReportDataSource - &amp;quot;pmaBillingDataSet1_Customer&amp;quot;) values have to match &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//to match the values in bindingSourceCustomer.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Also note that if you do not uses the Reset method as shown below, the viewer holds the reference to the last&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//instance used and doesn't do the new report because it's trying to use the old datasource. Yuk!&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Also note that after we've done it all, we have to call RefreshReport to get the report to display.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Unless the following is done, the reportviewer will not display a report containing subreports&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//The standard approach include private void SubreportBasicInfoEventHandler(object sender, SubreportProcessingEventArgs e) to handle the event&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//this.reportViewer1.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(SubreportBasicInfoEventHandler);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//it and call it in Form_Load. For the moment, I created the handler here.&lt;/p&gt;
&lt;p&gt;	 &amp;nbsp; &amp;nbsp;//Note that the sequence in which things happen needs to be right.	&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;case &amp;quot;Customer List&amp;quot;:&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;buttonShowReport.BackColor = System.Drawing.Color.Chocolate;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;listBoxReportCustomer.SelectedIndex = 0;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;listBoxReportMonth.SelectedIndex = -1;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;listBoxReportYear.SelectedIndex = -1;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;reportViewer1.LocalReport.DataSources.Clear();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;reportViewer1.Reset();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;reportViewer1.LocalReport.ReportPath = Application.StartupPath + @&amp;quot;\Reports\ReportCustomerList.rdlc&amp;quot;;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ReportDataSource mydatasource = new ReportDataSource(&amp;quot;pmaBillingDataSet1_Customer&amp;quot;, bindingSourceCustomer);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;reportViewer1.LocalReport.DataSources.Add(mydatasource);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;reportViewer1.RefreshReport();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;break;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;case &amp;quot;Current Invoice&amp;quot;:&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;buttonShowReport.BackColor = System.Drawing.Color.Chocolate;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;listBoxReportCustomer.SelectedIndex = 0;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;listBoxReportMonth.SelectedIndex = -1;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;listBoxReportYear.SelectedIndex = -1;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;reportViewer1.LocalReport.DataSources.Clear();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;reportViewer1.Reset();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;reportViewer1.LocalReport.ReportPath = Application.StartupPath + @&amp;quot;\Reports\ReportInvoiceContainer.rdlc&amp;quot;;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;reportViewer1.LocalReport.EnableExternalImages = true;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//the following values are for test purposes only&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//if the parameters are left empty, we get errors&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CompanyName = &amp;quot;Test Company Name&amp;quot;;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CompanyAddress = &amp;quot;1000 Main St.&amp;quot;;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;InvoiceImage1 = Application.StartupPath + &amp;quot;/images/InvoiceImage1.jpg&amp;quot;;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;InvoiceImage2 = Application.StartupPath + &amp;quot;/images/InvoiceImage2.jpg&amp;quot;;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//This sets the string value for a parameter (&amp;quot;ParamaterName&amp;quot;, value). The Parameter &amp;quot;CompanyNameParameter&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//is declared in the report as an empty parameter.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ReportParameter companynamevalue = new ReportParameter(&amp;quot;CompanyNameParameter&amp;quot;, CompanyName);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;reportViewer1.LocalReport.SetParameters(new ReportParameter[] {companynamevalue});&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ReportParameter companyaddressvalue = new ReportParameter(&amp;quot;CompanyAddressParameter&amp;quot;, CompanyAddress);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;reportViewer1.LocalReport.SetParameters(new ReportParameter[] {companyaddressvalue});&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//This parameter is used in the filter&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ReportParameter invoiceidnumber = new ReportParameter(&amp;quot;InvoiceIDNumberParameter&amp;quot;, textBoxInvoiceNumber.Text.ToString());&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;reportViewer1.LocalReport.SetParameters(new ReportParameter[] {invoiceidnumber});&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ReportParameter imagelogo1 = new ReportParameter(&amp;quot;ImagePath1Parameter&amp;quot;, InvoiceImage1);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;reportViewer1.LocalReport.SetParameters(new ReportParameter[] { imagelogo1 });&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ReportParameter imagelogo2 = new ReportParameter(&amp;quot;ImagePath2Parameter&amp;quot;, InvoiceImage2);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;reportViewer1.LocalReport.SetParameters(new ReportParameter[] { imagelogo2 });&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ReportDataSource mydatasourceinvoice = new ReportDataSource(&amp;quot;pmaBillingDataSet1_InvoiceLineItem2008&amp;quot;, bindingSourceInvoiceDetail);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;reportViewer1.LocalReport.DataSources.Add(mydatasourceinvoice);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.reportViewer1.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(SubreportInvoiceEventHandler);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;reportViewer1.RefreshReport();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;break;&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#8954305</link><pubDate>Tue, 16 Sep 2008 22:46:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8954305</guid><dc:creator>Yasser Ahmed</dc:creator><description>&lt;p&gt;Thanks for ur great effort &amp;gt;&amp;gt; I am working on web application and I have followed all your steps to add function in code to connect database and add the dll reference but i still get this error :There is an error on line 4 of custom code: [BC30002] Type 'SqlConnection' is not defined. &lt;/p&gt;
&lt;p&gt;My function is:&lt;/p&gt;
&lt;p&gt;Public Function TestConn(ByVal RevID As String, ByVal QstID As String, ByVal AnswID As String) As String &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Dim constr As String = &amp;quot;Data Source=THINKPAD\SQLEXPRESS;Initial Catalog=motorola;Integrated Security=SSPI&amp;quot; &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Dim ObjConn2 As SqlConnection = New System.Data.SqlClient.SqlConnection(constr) &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;ObjConn2.Open() &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Dim strSQL As String = &amp;quot;SELECT COUNT(dbo.MotoDetails.AnswerID) AS AnswerCount FROM Dale_Eval INNER JOIN MotoDetails ON Dale_Eval.Rev_ID = MotoDetails.Rev_ID WHERE MotoDetails.QuestID =&amp;quot; + QstID + &amp;quot; AND Dale_Eval.Rev_ID = &amp;quot; + RevID + &amp;quot; AND MotoDetails.AnswerID = &amp;quot; + AnswID + &amp;quot;&amp;quot; &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Dim cmd As SqlCommand = New System.Data.SqlClient.SqlCommand(strSQL, ObjConn2) &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Dim dr As SqlDataReader &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;dr = cmd.ExecuteReader(CommandBehavior.CloseConnection) &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;dr.Read() &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Dim TotlaAn As String = dr(0).ToString() &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;dr.Close() &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Return TotlaAn &lt;/p&gt;
&lt;p&gt;End Function &lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#9044805</link><pubDate>Wed, 05 Nov 2008 20:46:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9044805</guid><dc:creator>DarkAraym</dc:creator><description>&lt;p&gt;Thank you so much!!! I've been trying to do this for ages. For a while I was still getting the permission error, but thanks to Ceasar everything works great. AMAZING!&lt;/p&gt;
</description></item><item><title>Detecting Printing in Native Reports</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#9052243</link><pubDate>Fri, 07 Nov 2008 17:17:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9052243</guid><dc:creator>Doug Tumeo</dc:creator><description>&lt;p&gt;I am creating reports in SSRS 2005 that will be displayed directly from ReportServer, not within an application. In this situation, do you know of a way to hide controls based upon whether the report is rendered on screen or printed. (I want to hide some controls on printed output.)&lt;/p&gt;
&lt;p&gt;Thanks in advance,&lt;/p&gt;
&lt;p&gt;Doug&lt;/p&gt;
</description></item><item><title>Code class doesn't work</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#9195728</link><pubDate>Thu, 11 Dec 2008 11:33:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9195728</guid><dc:creator>toninicasanipasta</dc:creator><description>&lt;p&gt;Great post, but I'm trying to use Code class after introduce a function in Code tab and it doesn't work:&lt;/p&gt;
&lt;p&gt;Code tab:&lt;/p&gt;
&lt;p&gt;public function Hello()as string&lt;/p&gt;
&lt;p&gt; &amp;nbsp; return &amp;quot;Hello&amp;quot;&lt;/p&gt;
&lt;p&gt;end function&lt;/p&gt;
&lt;p&gt;Expression:&lt;/p&gt;
&lt;p&gt;=Code. &amp;nbsp; &amp;lt;---- And here it doesn't appear my function listed. Someone knows why? I'm gonna be crazy with this...&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#9469512</link><pubDate>Tue, 10 Mar 2009 22:07:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9469512</guid><dc:creator>en88</dc:creator><description>&lt;p&gt;And, ah. If you still are running problems with &amp;quot;no permission&amp;quot; message event after adding the AddTrustedCodeModuleInCurrentAppDomain and ExecuteReportInCurrentAppDomain, the error was gone when I inverted the order. So, you need to execute ExecuteReportInCurrentAppDomain first, then AddTrustedCodeModuleInCurrentAppDomain.&lt;/p&gt;
&lt;p&gt;I still don't get the permission after switch the position of two statements. I'm using VS 2008, is this the reason why it doesn't work for me?&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#9756088</link><pubDate>Tue, 16 Jun 2009 01:04:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9756088</guid><dc:creator>ChandraM</dc:creator><description>&lt;p&gt;Can you please let me know How I can build a dataset using custom code in rdlc report/document ?&lt;/p&gt;
</description></item><item><title>re: Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems &amp; Solutions)</title><link>http://blogs.msdn.com/mosharaf/archive/2005/12/20/LocalReportCustomCode.aspx#9756092</link><pubDate>Tue, 16 Jun 2009 01:05:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9756092</guid><dc:creator>ChandraM</dc:creator><description>&lt;p&gt;I am working on microsoft reports/documents and need help in building a dataset in the report custom code, can somebody help me?&lt;/p&gt;
</description></item></channel></rss>