Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Report name as variable?
Message
From
22/06/2004 13:53:03
 
General information
Forum:
ASP.NET
Category:
Reporting
Miscellaneous
Thread ID:
00916127
Message ID:
00916131
Views:
9
Hey Jeff,

I don't know anything about Crystal, but it sounds like you need to use reflection to get at this. Here's an example of using reflection:
string DLLName = "MyDLL";
string ClassName = "MyClass";
System.Reflection.Assembly oDLL;
object oClass;

// This "loads" the .DLL
oDLL = System.Reflection.Assembly.LoadFrom(DLLName);

// This creates the class instance
oClass = oDLL.CreateInstance(ClassName);
And if you need to pass parameters
// Create an instance of the desired form from the assembly
object [] args = new object[1];
args[0] = MyKey;
oForm = (Form)oDLL.CreateInstance(classname, true, System.Reflection.BindingFlags.CreateInstance, null, args, null, null);
I hope this points you in the right direction.

~~Bonnie


>Can I use a variable to instantiate a report?
>
>Like
>
>dim myreportname as string
>Dim orpt As CrystalDecisions.CrystalReports.Engine.ReportDocument
>
>myreportname = "myreport1"
>orpt = New myreportname
>
>This does not work. Is there a way??
>
>Jeff
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform