Page 1 of 1

Add code during runtime

Posted: Thu May 06, 2010 12:19 am
by GoodGuy17
Hello,
First, I am using this code: viewtopic.php?f=38&t=1998
Now, I need to know how to do something like:
NewButton.Code = Textbox1.Text
I know that won't work, but I really want to know! Please somebody help me!
~GoodGuy17 :D

Re: Add code during runtime

Posted: Thu May 06, 2010 6:11 pm
by mandai
Code: Select all
...

AddHandler z.Click, AddressOf oneClicked
Controls.Add(z)

..
Private Sub oneClicked(ByVal sender As System.Object, ByVal e As System.EventArgs)
  Dim cause As Button = sender
  cause.Text = Textbox1.Text
End Sub

Re: Add code during runtime

Posted: Thu May 06, 2010 7:59 pm
by GoodGuy17
Im sorry, but I need to do this:
When you click a button, it adds the code in textbox1 to the created button(like a msgbox), then when you click the button, it makes a msgbox.
That's what I need.

Re: Add code during runtime

Posted: Thu May 06, 2010 8:09 pm
by mandai
What do you mean by code? The event?
You can just set it with AddHandler.