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
|