Runtime set property from a string

57 views Asked by At

I have a string stored in database as 'GridColumn1.Caption = "XYZ"'

Is there a way to execute this code in runtime (on windows form load) to set GridColumn1's Caption property to "XYZ" in vb.net or in c#?

I want to read it from db on form load and set the captions and texts.

Thanks in advance.

1

There are 1 answers

4
Melvin On BEST ANSWER

Yes you can! You can use the Microsoft.CSharp.CSharpCodeProvider to compile and execute code during runtime.

More information can be found in the answers to this question.