Get values of Private Variable outside the class- HELP!

want to acess the value of the private variables declared in the class outside the class (in my agent)…Is there any way by which i can achieve this.I thought of creating a new Public get property which whill take parmater as the Varible name and pass the value to the agent which can be used generically as i may need many variable values…

below is just a simple eg as the original class is too complex and the variable values changes as per the functions called based on conditions…

Class abc

Private var1 as string

Private var2 as string

Private var3 as string

sub new (val as string)

if val=“1” then

func1

else

func2

end if

end sub

private function Func1

’ changes the values here …

me.var1=“hhh”

me.var2=“nnn”

end function

private function Func2

’ changes the values here …

me.var1=“98765”

me.var2=“12345”

end function

Public Property Get getPrivateVariable(VarName As Variant) As String

getPrivateVariable= Me.VarName

End Property

end class

Please suggest

Thanks in advance

Subject: Get values of Private Variable outside the class- HELP !!

Either make your variables public, or write a get method for each one.

The whole point of declaring a variable private is to make it private within the class.

Subject: Get values of Private Variable outside the class- HELP !!

Hi

Because I believe that LS is not reflective, you cannot do that

(Me.VarName won’t obviously work, because VarName ain’t a member of the class).

Could’nt you code your classes with Java ?

-ian-

Subject: Get values of Private Variable outside the class- HELP !!

Thanks Ian,But theres already an existing class and it is not feasible to re-write again using Java.Is there some way other than Me.varname which can help as we do it using Getitemvalue where passing the fieldname as string returns the value.

-Thanks Hemang