I have my app starting from a Sub Main in a module and want to show a form and have a button click event handled in the module.

In the module I have:

VB Code:
  1. Friend WithEvents frmForm1 As frmForm1
  2. Friend WithEvents btnRun As Button
  3.  
  4. Public Sub Main()
  5.         DoSomething()
  6. End Sub
  7.  
  8. Private Sub DoSomething()
  9.  
  10.         frmForm1 = New frmForm1
  11.         btnRun = frmForm1.btnRun
  12.         frmForm1.Show()
  13.        
  14. End Sub
  15.  
  16. Private Sub btnRun_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRun.Click
  17.  
  18.         MessageBox.Show("Clicked button")
  19.        
  20. End Sub

What is happening is the form comes up and then closes right away. What am I missing?

Thanks!