Thursday, March 22, 2012

Class Reference - Constructor with Arguments?

From the references tab, I see I can create an instance reference, but I do
not see how I can instantiate that class with a constructor that has
arguments. Does it only do the default New() constructor?
I would like something like: m_MyClass = New MyClass(Version as Integer)I have not found a way to do this. I will perform further research on it
and update you once I have more information.
Sincerely,
William Wang
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
This posting is provided "AS IS" with no warranties, and confers no rights.|||Hi David,
In the Reference tab of report properties, if we specify a instance name we
can only use the default constructor. If you need something other than the
default constructor, you can instantiate the class in the <Code> property
of the report instead. You'll need to reference the assembly on the
References tab of the report properties, but you would't declare an
instance there.
Instead, you'd declare the instance and initialize it in the Code property:
For example,
Dim m_myClass As MyClass
Protected Overrides Sub OnInit()
m_myClass = new MyClass(1234)
End Sub
Sincerely,
William Wang
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
This posting is provided "AS IS" with no warranties, and confers no rights.

No comments:

Post a Comment