Report Properties / Code (Use of OnInit Override)

  • Placed this code in the report properties/code window.

    Dim objRwh as new rsprototypenamespace.RSProtoTypeMethods()

    Dim strUser as string

    Protected Overrides Sub OnInit()

         struser = str(report.user!userid)

         'plan on calling a class with the userid, Ex: objRwh.myInit(struserid)

    End Sub

    I have placed other code in the onInit and it does function.

    Error:

    Failed to load expression host assembly. Details: specified argument was out of the range of valid values.

     

    Thank You.

  • This was removed by the editor as SPAM

  • It appears the when using the 'Report' object, it must passed to a class and not used in the local code.

    The following code works:

    Dim objRwh as RsProtoTypeNameSpace.RSProtoTypeMethods

    Protected Overrides Sub OnInit()

    objRwh = new RsProtoTypeNameSpace.RSProtoTypeMethods(Report.User!UserID)

    End Sub

  • I have very similar code to what you have, but I am running into this error when I try to use the object in the report.

    [rsCompilerErrorInExpression] The BackgroundColor expression for the textbox 'textbox2' contains an error: [BC30390] 'ReportExprHostImpl.CustomCodeProxy.X' is not accessible in this context because it is 'Private'

    I have a formatting class that stores font and color information for the report. So, for a backgroundColor property, instead of writing "white," I would write ""=code.X.color"

    Everything is marked public in the class. I can reference shared properties without any problem by writing "=namespace.classname.color." It also works if I specify the class name and instance name on the References tab. However, what I need is to load in user-specific colors, so I need to load a class for every user, similar to what you are doing. Did you encounter the "private" error message?

    Thank you.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply