Public Class ButtonGenerator
    Private Sub Button1_Click(ByVal sender As System.Object, _
      ByVal e As System.EventArgs) Handles Button1.Click

        ' Create a random number generator for choosing the
        ' new button's position.
        Dim Rand As New Random()

        ' Generate and configure the new button.
        Dim NewButton As New System.Windows.Forms.Button()
        NewButton.Left = Rand.Next(Me.Width)
        NewButton.Top = Rand.Next(Me.Height)
        NewButton.Size = New System.Drawing.Size(88, 28)
        NewButton.Text = "Nowy Przycisk"

        ' Add the button to the form.
        Me.Controls.Add(NewButton)

        ' Wire up the new button's Click event.
        AddHandler NewButton.Click, AddressOf Button1_Click

    End Sub

End Class