I have a dll which is developed in C#. I have made a reference to it from Reporting Services under Report Properties.
My problem is, that the methods in this dll are not static. Therefore under the Classes in Report Properties I have written the class-name and the instance-names of the instances that I need to use from this class (as I understand it, this is what you have to do if using non-static methods). In a text-box, I call one of the instances in the class, but I get this error:
[rsInvalidName] 'MyMethod()' is not a valid code class name. Names of objects must be CLS-compliant identifiers.
What exactly have I done wrong here?
Thanks
/Peter
Hi Peter,
In the code window, you'll need something similar to:
Dim InstanceName As Instance
Then you should be able to set the value of your textbox to: =Code.InstanceName.FunctionName(Params).
Keep in mind that all of these lines are case-sensitive.
If this isn't working, could you post a snippet of what you're doing, so we can take a further look at it?
-Jessica
|||Hi Jessica. Thanks for your reply :-)
I have a class (let's call it myClass) and a method in that class (let's call it myMethod).
The Class is declared as: public class myClass and the method is declared as: public string myMethod(params).
The resulting dll (let's call it myDLL) is added to the references-tab of Report Properties. In the Code-tab I have written (I have tried many combinations): Public Dim class1 As myDLL.myClass. I have used the Public-keyword because it complained that class1 was declared private. In the textbox-controller I have written: =code.class1.myMethod(params). But it doesn't work. The text-box writes: #Error and I get the warning:
Build complete -- 0 errors, 0 warnings
[rsRuntimeErrorInExpression] The Value expression for the textbox 'textbox5' contains an error: Object reference not set to an instance of an object.
So it appears that class1 is not an instance of myDLL.myClass. I have tried many combinations and also with and without adding "Class name" and "Instance name" in the References tab of Report Properties.
Any suggestions ?
Thanks
/Peter
|||Hi again,
I works now. I removed the code in the Code-tab and added the class to the References-tab under "Class name" and "Instance name". I then wrote: =code.InstanceName.MethodName(param) in the text-box and it works. I didn't have the "code" part to begin with, so that was my problem.
Thanks for your input. I appreciate it :-)
/Peter
No comments:
Post a Comment