Hello
How would I go about making a program were It re-writes the code of a button through the text of a textbox.
Let me clear this up a little bit more.
I'm working on a program that currently has 2 buttons and a textbox. Now when I press Button1 I want it to write TextBox1's Text into Button2's Code.
So for example: Lets say I put Msgbox("hello") into textbox1 and then pressed Button1, then pressed button2 and A message box saying Hello would pop-up.
If anyone knows how to do this, It could help me greatly
Thanx in advance.

Re-Writing Code?
Red Link
hi,
//So for example: Lets say I put Msgbox("hello") into textbox1 and then pressed Button1, then pressed button2 and A message box saying Hello would pop-up.
i don't think you can put messagebox into textbox, actualy the above examples will do this for simplicity you can use a class memeber to do this something like this
string msg;
sub button1_click(.......)
msg = textbox1.Text;
end sub
sub button2_click(.......)
MessageBox.show(msg);
end sub
hope this helps
Marvy
I would categorize this as non-trivial, but it is certainly possible. You can use the classes in System.CodeDom to create a dynamic assembly that contains the code that you have in your text box and call it in your ButtonClick handler.
For more information, see:
http://msdn2.microsoft.com/en-us/library/saf5ce06.aspx
http://msdn2.microsoft.com/en-us/library/system.codedom.compiler.codecompiler.fromdom(VS.80).aspx
http://msdn2.microsoft.com/en-us/library/k3a58006(VS.80).aspx
http://msdn.microsoft.com/msdnmag/issues/05/12/CodeGeneration/default.aspx
[Or you follow Ralph's reply above :)]
Best regards,
Johan Stenberg
frans poc
but it just about constitutes self modifying code.....but not quite.
Is this seen as meaningful practice
BhuttCrackSpackle
look at the following link, it looks like the thing you want to do:
http://www.codeproject.com/dotnet/evaluator.asp
ralph