Thursday, March 8, 2012

Code Initialization Problem

I try to initialize my object in OnInit, however, there is always an erroe saying
"[BC30469] Reference to a non-shared member requires an object reference."
My code is very simple and it is like this :
Dim MyObj as MyClass
Protected Overrides Sub OnInit()
MyObj = New MyClass
MyObj.Init(User!Language)
End Sub
The error part is when I want to pass in User!language to my method. It seems whenever I access
a global collection object, the system will give me that error. I've tried acess User,Parameters, Globals
all give me the same error when compile. I've even tried the following and it still give me error. so it
is not realted to my class.
Protected Overrides Sub OnInit()
Dim Test as object
Test = User!Language
End Sub
According to Book online, I should be able to access User, Parameter and Globals in Oninit.
Anyone has a clue on what is happening ?
Thanks
EdchyOne of the developers took a look at this and found that the documentation
is incomplete.
You need to access global collections from the Report object, like this:
Test = Report.User!Language
This post is provided 'AS IS' with no warranties, and confers no rights. All
rights reserved. Some assembly required. Batteries not included. Your
mileage may vary. Objects in mirror may be closer than they appear. No user
serviceable parts inside. Opening cover voids warranty. Keep out of reach of
children under 3.
"Edchy Tsoi" <edchytsoi@.techland.com.hk> wrote in message
news:uALwmlhaEHA.3480@.TK2MSFTNGP11.phx.gbl...
> I try to initialize my object in OnInit, however, there is always an erroe
saying
> "[BC30469] Reference to a non-shared member requires an object reference."
> My code is very simple and it is like this :
> Dim MyObj as MyClass
> Protected Overrides Sub OnInit()
> MyObj = New MyClass
> MyObj.Init(User!Language)
> End Sub
> The error part is when I want to pass in User!language to my method. It
seems whenever I access
> a global collection object, the system will give me that error. I've tried
acess User,Parameters, Globals
> all give me the same error when compile. I've even tried the following
and it still give me error. so it
> is not realted to my class.
> Protected Overrides Sub OnInit()
> Dim Test as object
> Test = User!Language
> End Sub
> According to Book online, I should be able to access User, Parameter and
Globals in Oninit.
> Anyone has a clue on what is happening ?
> Thanks
> Edchy
>

No comments:

Post a Comment