groads2 Posted June 26, 2012 Posted June 26, 2012 (edited) I have a form that is instantiated with the following code. When I click the ok or cancel buttons that are on the form I call me.close() but the form does not close. I just stays on my screen and my application is hung. The form is not running on the same thread as the main form. If _frmAppManpower Is Nothing Then _frmAppManpower = New frmAppManpower AddHandler _frmAppManpower.FormClosed, AddressOf OnFormClosed End If With _frmAppManpower .RosterID = rosterID .ApparatusName = apparatusName .TopMost = True .WindowState = FormWindowState.Normal .ShowDialog(whndle) .TopMost = False .Activate() End With Edited June 27, 2012 by snarfblam Quote
Leaders snarfblam Posted June 27, 2012 Leaders Posted June 27, 2012 The form is not running on the same thread as the main form. Does the form work properly if you launch it from the main thread? WinForms is not thread-safe, and all your UI code should be running on the same thread. Quote [sIGPIC]e[/sIGPIC]
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.