How to Run a Code Stored in String

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
 
T

Tom Shelton

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.
 
B

Bharani Dharan

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
 
C

Cor Ligthert[MVP]

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
 
B

Bharani Dharan

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top