Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - VB.NET -- Dynamically created controls
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

VB.NET -- Dynamically created controls

 Post Reply Post Reply Page  <1 234
Author
plaudeman View Drop Down
Newbie
Newbie


Joined: 28 May 2004
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote plaudeman Quote  Post ReplyReply Direct Link To This Post Posted: 28 May 2004 at 6:25pm

Originally posted by pmormr pmormr wrote:

is there any way to a function to a dynamically created button on a Win Form for VB.NET? Even if it could inherit the functions and attributes from another button it would be fine.

Sure, it's fairly simple. Here is an example:

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim b As New Button
b.Text = "Click Me"

AddHandler b.Click, AddressOf B_Click

Me.Controls.Add(b)

End Sub

Private Sub B_Click(ByVal sender As Object, ByVal e As EventArgs)

MsgBox("Button was clicked!")

End Sub

Back to Top
pmormr View Drop Down
Senior Member
Senior Member


Joined: 06 January 2003
Location: United States
Status: Offline
Points: 1479
Post Options Post Options   Thanks (0) Thanks(0)   Quote pmormr Quote  Post ReplyReply Direct Link To This Post Posted: 28 May 2004 at 7:20pm
you have got to be F***ING kidding me... i owe you one... or two... or three... thanks a bunch
Back to Top
pmormr View Drop Down
Senior Member
Senior Member


Joined: 06 January 2003
Location: United States
Status: Offline
Points: 1479
Post Options Post Options   Thanks (0) Thanks(0)   Quote pmormr Quote  Post ReplyReply Direct Link To This Post Posted: 28 May 2004 at 7:21pm
it was that simple all along... thank god that one's solved
Back to Top
 Post Reply Post Reply Page  <1 234

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.