Application.Run and Form.ShowDialog
Posted on 2004-04-01
Hello there. I'll be very grateful is anyone could shed light on this problem I'm having. I'm using VB .net
This is my sub main:
Dim Frm1 as new Form1()
if Frm1.showdialog() = OK then
Dim Frm2 as new Form2()
Frm2 = nothing
ApplicationLoop = false
The application runs with the intended results during the first loop - show dialog, wait for user input, if user clicks ok then display Frm2.
However, when the user closes Frm2, the second loop starts, the dialog is shown, but doesnt wait for the user input. The dialog is immediately closed, frm.showdialog evaluates to not ok and the application exits.
I'm quite sure its caused by Application.run(Frm2) because if I remove it then the dialog is displayed and waits for user input. Could someone explain why and perhaps offer a suggestion?