title: Add handler to runtime-created control
body: <p>I found in StackOverflow some vb.net code written by "PaRiMaL RaJ". i want the same think but i must convert this code to work on VB6.
  can you help me please??? </p>
  
  <pre><code>Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      ' creating control
      Dim btn1 As Button = New Button()
      Dim btn2 As Button = New Button()
  
      btn1.Parent = Me
      btn1.Name = "btn1"
      btn1.Top = 10
      btn1.Text = "Btn1"
  
      btn2.Parent = Me
      btn2.Name = "btn2"
      btn2.Top = 50
      btn2.Text = "Btn2"
  
      'adding handler for click event
      AddHandler btn1.Click, AddressOf HandleDynamicButtonClick
      AddHandler btn2.Click, AddressOf HandleDynamicButtonClick
  
  
  End Sub
  
  Private Sub HandleDynamicButtonClick(ByVal sender As Object, ByVal e As EventArgs)
      Dim btn As Button = DirectCast(sender, Button)
  
      If btn.Name = "btn1" Then
          MessageBox.Show("Btn1 clicked")
      ElseIf btn.Name = "btn2" Then
          MessageBox.Show("Btn2 Clicked")
      End If
  
  End Sub
  </code></pre>