Results 1 to 4 of 4

Thread: [RESOLVED] Shutdown error due to Unshown form

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2020
    Posts
    70

    Resolved [RESOLVED] Shutdown error due to Unshown form

    My winforms application consists of multiple forms, but the user is only presented with one form at a time.
    In the background, the application might be using functions and procedures from other forms.
    The issue is, one of these background forms is preventing my system shutdown by throwing error. The form in question here, was not presented(.shown() not done).
    I tried finding the root cause of the issue, but could not find anything relevant.
    Is anyone aware about why an unshown form is receiving WM_QUERYENDSESSION from the os?

  2. #2
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Posts
    12,370

    Re: Shutdown error due to Unshown form

    Why are you architecting your system like this? If you have shared code that needs to be accessed without initializing some sort of variable then you should setup a module or class with shared methods.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | HtmlLessons | CssLessons | Code Tags | Sword of Fury - Jameram

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2020
    Posts
    70

    Re: Shutdown error due to Unshown form

    The hidden form has some code that operates based on values of some UI componenets, like textbox values, DataGrid Content etc. Due to lack of time and the business requirement, logic and UI separation was not done, and we had to continue maintaining the code in same manner. Hence, the hidden form logic is being used.

  4. #4
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,413

    Re: Shutdown error due to Unshown form

    Quote Originally Posted by IT_Researcher View Post
    The hidden form has some code that operates based on values of some UI componenets, like textbox values, DataGrid Content etc. Due to lack of time and the business requirement, logic and UI separation was not done, and we had to continue maintaining the code in same manner. Hence, the hidden form logic is being used.
    You have to fix it one way or another. Might as well fix it properly…

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width