title image


Smiley Re: Button dynamisch erstellen VB.Net
auch das ist nicht sonderlich schwierig...

du hast 2 möglichkeiten.

1.



Private WithEvents b As Button



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

b = New Button

b.Name = "myButton"

b.Text = "Click mich"

b.Dock = DockStyle.Bottom

Me.Controls.Add(b)

End Sub



Private Sub Button_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles b.Click

MessageBox.Show("Click")

End Sub



und 2.



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

Dim b As New Button

b.Name = "myButton"

b.Text = "Click mich"

b.Dock = DockStyle.Bottom

Me.Controls.Add(b)



AddHandler b.Click, AddressOf Button_Click

End Sub



Private Sub Button_Click(ByVal sender As Object, ByVal e As System.EventArgs)

MessageBox.Show("Click")

End Sub



geschrieben von

Login

E-Mail:
  

Passwort:
  

Beitrag anfügen

Symbol:
 
 
 
 
 
 
 
 
 
 
 
 
 

Überschrift: