vb.net - Accessing subclass or subproperty using CallByName -
i can access class' subvalues using callbyname (in other words, can class.subvalue
it).
error when want class.subclass.subvalue
using callbyname.
possible using callbyname (or using smtg else)?
here's typical code:
class class1 public somevariable long=123 'now "class1" has "somevariable" end class class class2 public subclass new class1 'now "class2" has subclass "class1" end class sub test() dim c1 new class1, c2 new class2 'this works fine, , can c1.somevariable. it's ok. a=callbyname(c1,"somevariable",calltype.get) 'but error here... , can't c2.subclass.somevariable b=callbyname(c2,"subclass.somevariable",calltype.get) end sub
-- edit: here actual question. --
i want load parameters file form's controls, , in file parameters written this:
<controlname>.<property>=<value> | textbox1.text=sometext | button2.left=1234
, error when use:
callbyname(myform, "<controlname>.<property>", calltype.set, "<value>")
how can fix problem (using callbyname or smtg else)?
i used simple recoursive function
function recursivegetvalue(byval name string, byval data object) object if name.contains(".") = true recursivegetvalue = recursivegetvalue(name.substring(name.indexof(".") + 1), callbyname(data, name.split(".")(0), calltype.get)) else recursivegetvalue = callbyname(data, name, calltype.get) end if
end function
Comments
Post a Comment