Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I'm looking to create buttons dynamically at run-time. The below code works in ASP with Web Controls. I would like use something equivalent in a windows forms application with click events working.

 

Dim i As Integer

For i = 1 To txtCreate.Text

Dim objButton As HtmlButton

objButton = New HtmlButton()

objButton.InnerText = "button1" & i

objButton.ID = "btnButtton" & i

myPlace.Controls.Add(objButton)

objButton.Attributes.Add("runat", "server")

Next

 

any help much appreciated!

  • *Experts*
Posted

What a coincidence... I was just browsing MSDN online and I ran

across this article. It doesn't show how to add event handlers,

but I can tell you that you need to use the AddHandler statement

and AddressOf to get the address of the sub which you want to

handle the event of the buttons.

 

http://support.microsoft.com/default.aspx?scid=KB;en-us;q308433

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...