Thanks but I was looking for something much easier. I think I misled you with the 'instantiate' in my question.
The following works for anyone interested.
Dim orpt As New CrystalDecisions.CrystalReports.Engine.ReportDocument
dim RptPath , RptName as string
RptPath = "C:\inetpub\wwwroot\mydir\"
RptName = Request.form("RequestedRptName")+".rpt"
orpt.Load(RptPath + RptName)
>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
It's Time to get a gun.
That's what I've been thinkin.
I think I can afford one, If I do a little less Drinkin.www.TrueGeeks.com