Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Addins and reflection, using reflection in an Addin
Message
De
11/02/2008 13:07:21
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Addins and reflection, using reflection in an Addin
Divers
Thread ID:
01291548
Message ID:
01291548
Vues:
46
I’m creating an addin to wrapper Crystal reports in a custom class for use in my ReportManager. The user will get a drop down listing all the projects in the current soloution. Next the user gets a list of all the crystal reports found in that project and can select which reports to create wrapper classes for. After selecting the crystal reports that the user want to wrapper. I want to create an instance of each of those crystal reports so that I can retrive parameter information along with other properties. This is where I’m running into problems. I get the Assembly for the project that has the reports loaded via
cryAssembly=System.Reflection.Assembly.LoadFile(“the projects assembly”) This returns the assembley but when I try to create an instance of anything in the assembly it returns Null. Heres an example of what I'm trying to do.
Dim CrystalReportName As String
        Dim NewWrapper As WrapperBase
        Dim oCrystalReport As CrystalDecisions.CrystalReports.Engine.ReportDocument
        Dim strassem As String = GetAssemblyName()
        'loop through all the reports selected by the user
        For Each CrystalReportName In CrystalReportsList
            'create a new wrapper for this report
            NewWrapper = New WrapperBase
            'set the name
            NewWrapper.CrystalReportName = CrystalReportName
            'create an instance of the report so we can get the parameters
            Dim assemb As System.Reflection.Assembly
            'load the assebly
            assemb = System.Reflection.Assembly.LoadFile(strassem)
            If Not (assemb Is Nothing) Then
                'create the report
                Dim objTest As Object = assemb.CreateInstance(System.IO.Path.GetFileNameWithoutExtension(CrystalReportName), True)
                oCrystalReport = CType(objTest, CrystalDecisions.CrystalReports.Engine.ReportDocument)
            End If
            'Do some more stuff to finish the wrapper
            Me.WrapperList.Add(NewWrapper)
        Next
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform