Property Bouton() As Button Get Return bt End Get Set(ByVal value As Button) bt = New Button bt = value Me.Controls.Add(bt) End Set End Property
Dim WithEvents bt As Button
Private Sub bt_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles bt.Click MessageBox.Show("coucou") End Sub
Dim ttt = New Button With ttt .Text = "tttt" .Visible = True .Left = 4 .Top = 4 End With Dim MaForm2 As New Form2 MaForm2.Bouton = ttt MaForm2.Show()