Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Control Box does not close form

Control Box does not close form

Scheduled Pinned Locked Moved C#
csharphelpcomquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Darryl Borden
    wrote on last edited by
    #1

    I have run into an issue in C# / .Net where the control box will not close the form when the user clicks on it. When my app initially runs, it works fine, but after a while it does nothing when clicked on. I have multiple apps that act in this manner. Has anyone else run into this? Is there a fix for it? dpb Darryl Borden Principal IT Analyst darryl.borden@elpaso.com

    H 1 Reply Last reply
    0
    • D Darryl Borden

      I have run into an issue in C# / .Net where the control box will not close the form when the user clicks on it. When my app initially runs, it works fine, but after a while it does nothing when clicked on. I have multiple apps that act in this manner. Has anyone else run into this? Is there a fix for it? dpb Darryl Borden Principal IT Analyst darryl.borden@elpaso.com

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      This commonly happens when a multi-threaded app has different threads setting properties on the controls that were created in a different thread, or when unhandled exceptions occur during instantiation of the main application form (the form used in the call to Application.Run). First go through and make sure that you're handling all exceptions that could occur during instantiation of your child controls and that no worker threads are setting properties (and many times even getting properties) or calling methods on the controls from those threads (see Control.InvokeRequired and Control.Invoke in the .NET Framework SDK for more information). A work-around is to use Application.Quit for your File->Exit (or whatever) menu instead of just calling Close on your form.

      Microsoft MVP, Visual C# My Articles

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups