Current filter:
                                You should refresh the page.
                                Support Center
                                  • I have an application installed at a client's site that was built with DevEx v9.3, and I am trying to write a VB script in a report file that needs to access an object from another assembly. I have read a lot about setting ScriptReferencesString at run time, but nothing that indicates you can do this from within a script. Is it possible to do this in the script, and if so, which event should I be using?

                                    Currently I am trying to set ScriptReferencesString right before the line of code that accesses the object (in a BeforePrint event), but it doesn't seem to make any difference. I have hard coded the path to make sure I have that correct, but nothing seems to work.

                                    Is it possible to do this without re-building the application?


                                Hi David,

                                Please define the ScriptReferencesString property in the constructor of the XtraReport1 class. Here is some sample code:

                                .... Partial Public Class XtraReport1 Inherits DevExpress.XtraReports.UI.XtraReport Public Sub New() InitializeComponent() 'Uncomment following string to add the reference at runtime. 'report.ScriptReferencesString = "Dlls\\MyAssembly1.dll\r\nDlls\\MyAssembly2.dll"; End Sub End Class ....
                                Hope this helps you. Thanks for your feedback in advance.




                                Thanks for your response, however it appears to me that your solution is to be implemented in the project source (from Visual Studio), not the script. In my original request I stated that in this case I am not able to rebuild the application, so I am looking for a solution that can be implemented entirely within the script. To clarify, the application allows the user to open the report in the designer and edit the scripts, so that is where I am trying to implement the solution.

                                In any case, I had a go at your suggestion by adding a constructor to the scripts, and although I can verify that the code runs, it does not solve the problem. This is what I added to the scripts section (from the run time report designer available in the application):

                                Public Sub New
                                    Dim r As XtraReport = CType(PageHeader.Parent, XtraReport)
                                    r.ScriptReferencesString = "C:\DLLPath\MyCustomLibrary.dll"
                                End Sub

                                Note that I am accessing the "Report" via the PageHeader because the keyword "Me" refers to the ScriptingReport object at this point. If I use Me.ScriptReferencesString I get the error:

                                'ScriptReferencesString' is not a member of 'ScriptingNamespace.ScriptingReport'

                                There's probably a better way, but this at least runs without error. However, even though this executes successfully before the line that references the object in my dll, I still get the original error:

                                error BC30002: Type 'MyCustomLibrary.TransactionList' is not defined.

                                P.S. I note that in your solution you have used a double backslash in the path: Dlls\\MyAssembly1.dll
                                I tried this as well but it made no difference.

                                David Leckenby


                                Hello David,

                                Thank you for the update. The problem is caused by the fact that it is too late to update the report's ScriptReferencesString from its scripts since they are compiled before they are executed. Thus, adding script references from the scripts will not have any effect. You should accomplish this from the code-behind of your application before the report preview is invoked. However, you can do this in the End-User Report Designer , too. Attached is a small solution and screencast, illustrating how this can be done. Hopefully, you will find this information helpful.

                                P. S.: Please note that this scenario will only work in v2010 vol 1.8 and later versions due to the Scripts - Functionality from an external assembly breaks scripts until placed along with the application executable bug.



                                Adding the references via the end user designer did the trick - too easy. Thanks so much for your help.


                                Hi David,

                                Thank you for your feedback.

                                I am glad to hear that you have resolved this problem. Please contact us if you experience any further difficulties.


                                If you need additional product information, write to us at or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, ASP.NET, WinForms, HTML5 or Windows 10, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2017 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners