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:
Friend WithEvents frmForm1 As frmForm1 Friend WithEvents btnRun As Button Public Sub Main() DoSomething() End Sub Private Sub DoSomething() frmForm1 = New frmForm1 btnRun = frmForm1.btnRun frmForm1.Show() End Sub Private Sub btnRun_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRun.Click MessageBox.Show("Clicked button") End Sub
What is happening is the form comes up and then closes right away. What am I missing?
Thanks!


Reply With Quote
