Private Sub RunTimeControl
      Dim btn As New System.Windows.Forms.Button
      Me.Width = 300
      Me.Height = 150
      btn.Visible = True
      btn.Size = New Size(75, 25)
      btn.Text = "Runtime button"
      btn.Location = New Point(100, 45)
      Me.Controls.Add(btn)
      AddHandler btn.Click, AddressOf Me.btn_Click
  End Sub
    
   Public Sub btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn.click
      ' do whatever here
      Beep()
   End Sub
 
11/01/2015
TheLonelyProgrammer.Net
Alone in a sea of non-programmers
Home Random Regular expressions Create control at runtime Text files: Read & Write