How to Run a Code Stored in String

  • Thread starter Thread starter Bharani Dharan
  • Start date Start date
B

Bharani Dharan

hi all

how do I get the compiled value of the code stored in a string?

For instance:-
dim strVal as String = "Response.write(1)"

I want the code stored in the string to be executed and when in print the string it shld return me the value '1'. is this doable? any help?

Regs,
Bharani Dharan
Windows Live Butterfly
 
hi all

how do I get the compiled value of the code stored in a string?

For instance:-
dim strVal as String = "Response.write(1)"

I want the code stored in the string to be executed and when in print the string it shld return me the value '1'. is this doable? any help?

Regs,
Bharani Dharan
Windows Live Butterfly

You'll want to look into CodeDom to compile and execute your code.
 
Thnx for the reply

I didn't get clearly as im at the beginner level is it possible for you give explanation more on this and wil tat work in Framework 1.1?

thnx again

Regs,
Bharani Dharan
Windows Live Butterfly
hi all

how do I get the compiled value of the code stored in a string?

For instance:-
dim strVal as String = "Response.write(1)"

I want the code stored in the string to be executed and when in print the string it shld return me the value '1'. is this doable? any help?

Regs,
Bharani Dharan
Windows Live Butterfly
 
Bharani,

You are in this case working at the server side, while you want to do something at client side.

Here a sample how you can do things as you want.

http://www.vb-tips.com/AstroBoys.aspx

However in your case it can much simpler.

If you want to show 1 on a page, then set an aspbet label on it, and set in your server side code (you call this probably code behind)

Mylabel = "1"

Cor
 
thnx cor.

tat was a gr8 help.

Regs,
Bharani

--

Regs,
Bharani Dharan
Windows Live Butterfly
Bharani,

You are in this case working at the server side, while you want to do something at client side.

Here a sample how you can do things as you want.

http://www.vb-tips.com/AstroBoys.aspx

However in your case it can much simpler.

If you want to show 1 on a page, then set an aspbet label on it, and set in your server side code (you call this probably code behind)

Mylabel = "1"

Cor
 
Back
Top