How would you solve this? This project is working with MS SQL Server, and there are forms with dozens of queries on them, mostly used to load up lookup comboboxes. There's a main Client Search form that lets you find someone's file. Then you double-click on the line in a list that contains the client you want to deal with; this makes it zoom-in on the selected client and their details.

How would you solve this? This project is working with MS SQL Server, and there are forms with dozens of queries on them, mostly used to load up lookup comboboxes. There's a main Client Search form that lets you find someone's file. Then you double-click on the line in a list that contains the client you want to deal with; this makes it zoom-in on the selected client and their details.

From this point on (double-clicking the entry in the list), it can take up to ten (10) seconds to load up the required form, mainly because of all of the queries that are run prior to it becoming visible. The forms are created dynamically, and the FormShow method opens all of the queries needed to initialize the form. And they take a long frigging time to run, relatively speaking.

(The form does not become visible until after FormShow completes running.)

There's a LaunchForm method that's called to open most of the forms. Here's the general flow:

* create an instance of the required form
* initialize things needed on the new form, if any
* hide the current form
* show the new form
* when the new form closes:
** free the new form
** show the previous form

Because the FormShow method opens all of the queries, and most of the called forms can modify the database, when you close a form and control goes back to the previous form, it again takes a while to run the queries and refresh everything. (The logic isn't checking to see if anything changed, it just assumes it did and refreshes everything.)

The net effect is the screen is blank for many seconds between when the current form is hidden and the new form actually appears.

The only really unusual thing here is hiding the calling form. That's a requirement that's not relevant to this discussion, but it's important in this situation.

I want to display a little status dialog that lets the user know something is going on and the program didn't go out to lunch, because some of the people running this app have very slow computers and switching between forms can take 10-15 seconds to appear. Currently, it looks like the app silently crashed ... until a while later when the desired form reappears. Users need some feedback.

I'm curious how people have solved this in the past?

(I can detail out the exact calling mechanism, but the meat is what I described above.)

Comments

  1. Attila Kovacs Very sorry for the confusion.

    I appreciate all of the suggestions! It got the juices flowing and I was able to implement something that's working (as explained above).

    RE: zombie form ... it turns out someone put an Action handler on the Cancel button. It's the first Action handler I've seen in the entire application! Just on this one button. Sheesh. Gotta search for more.

    ReplyDelete

Post a Comment