Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (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 by snarfblam
  • Leaders
Posted
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.

[sIGPIC]e[/sIGPIC]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...