How do I display second form without loosing application focus

  • Thread starter Thread starter Kohn
  • Start date Start date
K

Kohn

The following code fragment will only show the first
form. Subsequent forms show up in "Settings, Memory,
Running Programs" and have to be activated. The actual
program uses other threads and the Invoke method for
updating controls so I have to use "Application.Run(frm)"
otherwise, "frm.ShowDialog()" doesn't process the Invokes.


Sub Main()
Dim f1 As Focus1
Dim f2 As Focus2
Do
f1 = New Focus1
Application.Run(f1)

f2 = New Focus2
Application.Run(f2)

Loop
End Sub

Thanks
 
Hi Kohn,

As you've seen that is NOT the correct way to do it, you only need a single
call to Application.Run(), your second and subsequent forms would normally
be called from the first form as required, unless you have a main class,
using something like f2.ShowModal().

Chris.
 
Back
Top