Jeff,
>Thanks but I was looking for something much easier. I think I misled you with the 'instantiate' in my question.Yep, I haven't used Crystal at all, so I didn't know what was necessary to load a report. In your original question you used
oRpt = New MyReportName as your example, so it looked like an instantiation issue. Anyway, it turns out to be just a parameter passing issue and you figured it out, so that's cool. =)
~~Bonnie
>
>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