Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

WWWXXXDOCO, nu vot, WWWXXXAPC, dhcpd lease file "binding state", WWWXXXDOCO, how to setup procmail to process html2text, how to setup procmail html2text, WWWXXXAPC., XXXCNZZZ, ss4000 recovery array

Links

XODOX
Impressum

#1: set complex property on the fly

Posted on 2005-12-03 21:49:38 by George Meng

Hi folks,



I have a Treeview control in the Winform, and I want to change the text of
the 5th node base on an expression:



dim sObject as string = "Treeview1.Node.Items(5).Text"

dim sValue as string = "New Text for the node"



How can I make this happen by using reflection or any other way?



Basically, my question is how I can make change to a complex property:

Object.Property.property



Thanks for any ideas.



George

Report this message

#2: Re: set complex property on the fly

Posted on 2005-12-04 02:59:44 by vimakefile

You'll need to:
(1) parse your expression string, then use the System.Reflection API to get
the values of each sub-property in turn.
or
(2) Comple the expression and load the resulting assembly (requires compiler
installed)
or
(3) Choose a scripting language that can handle your expression, and ask it
to evaluate your expression. (Try IronPython- that should work for you.)

m


"George Meng" <georgemeng2000@sohu.com> wrote in message
news:e5U5MsE%23FHA.2616@TK2MSFTNGP15.phx.gbl...
> Hi folks,
>
>
>
> I have a Treeview control in the Winform, and I want to change the text of
> the 5th node base on an expression:
>
>
>
> dim sObject as string = "Treeview1.Node.Items(5).Text"
>
> dim sValue as string = "New Text for the node"
>
>
>
> How can I make this happen by using reflection or any other way?
>
>
>
> Basically, my question is how I can make change to a complex property:
>
> Object.Property.property
>
>
>
> Thanks for any ideas.
>
>
>
> George
>
>

Report this message

#3: Re: set complex property on the fly

Posted on 2005-12-04 03:06:04 by vimakefile

"Mike" <vimakefile@yahoo.com> wrote in message
news:ez90mZH%23FHA.2324@TK2MSFTNGP11.phx.gbl...
>
> You'll need to:
> (1) parse your expression string, then use the System.Reflection API to
> get the values of each sub-property in turn.
> or
> (2) Comple the expression and load the resulting assembly (requires
> compiler installed)

or
(2a) Parse your expression string, and use Reflection.Emit to generate code
on the fly, and load the assembly. (I didn't mention this before, as it's
the hardest and probably won't by you much over (1) unless you call the same
expression over and over many times

> or
> (3) Choose a scripting language that can handle your expression, and ask
> it to evaluate your expression. (Try IronPython- that should work for
> you.)
>
> m
>
>
> "George Meng" <georgemeng2000@sohu.com> wrote in message
> news:e5U5MsE%23FHA.2616@TK2MSFTNGP15.phx.gbl...
>> Hi folks,
>>
>>
>>
>> I have a Treeview control in the Winform, and I want to change the text
>> of the 5th node base on an expression:
>>
>>
>>
>> dim sObject as string = "Treeview1.Node.Items(5).Text"
>>
>> dim sValue as string = "New Text for the node"
>>
>>
>>
>> How can I make this happen by using reflection or any other way?
>>
>>
>>
>> Basically, my question is how I can make change to a complex property:
>>
>> Object.Property.property
>>
>>
>>
>> Thanks for any ideas.
>>
>>
>>
>> George
>>
>>
>
>

Report this message

#4: Re: set complex property on the fly

Posted on 2005-12-04 14:45:38 by George Meng

Thanks Mike, your suggestions are very helpful. I prefer to use reflection
to do it.
I will try.

"Mike" <vimakefile@yahoo.com> дÈëÏûÏ¢ÐÂÎÅ:uxfRJdH%23FHA.160@TK2MSFTNGP12.phx.gbl...
>
> "Mike" <vimakefile@yahoo.com> wrote in message
> news:ez90mZH%23FHA.2324@TK2MSFTNGP11.phx.gbl...
>>
>> You'll need to:
>> (1) parse your expression string, then use the System.Reflection API to
>> get the values of each sub-property in turn.
>> or
>> (2) Comple the expression and load the resulting assembly (requires
>> compiler installed)
>
> or
> (2a) Parse your expression string, and use Reflection.Emit to generate
> code on the fly, and load the assembly. (I didn't mention this before, as
> it's the hardest and probably won't by you much over (1) unless you call
> the same expression over and over many times
>
>> or
>> (3) Choose a scripting language that can handle your expression, and ask
>> it to evaluate your expression. (Try IronPython- that should work for
>> you.)
>>
>> m
>>
>>
>> "George Meng" <georgemeng2000@sohu.com> wrote in message
>> news:e5U5MsE%23FHA.2616@TK2MSFTNGP15.phx.gbl...
>>> Hi folks,
>>>
>>>
>>>
>>> I have a Treeview control in the Winform, and I want to change the text
>>> of the 5th node base on an expression:
>>>
>>>
>>>
>>> dim sObject as string = "Treeview1.Node.Items(5).Text"
>>>
>>> dim sValue as string = "New Text for the node"
>>>
>>>
>>>
>>> How can I make this happen by using reflection or any other way?
>>>
>>>
>>>
>>> Basically, my question is how I can make change to a complex property:
>>>
>>> Object.Property.property
>>>
>>>
>>>
>>> Thanks for any ideas.
>>>
>>>
>>>
>>> George
>>>
>>>
>>
>>
>
>

Report this message