tags:

views:

36

answers:

4

I've got a form in a 24/7 application that will probably be needed as many as 1000 time a day. Does it make sense to create/destroy this form every time I need it, or is this an example of a situation where the form should be permanent?

A: 

Just keep it permanently. If that annoys the users then you can let it minimize to the status bar (making it disappear from the task bar) and allow users to show it again by either clicking on the status icon or the program itself (meaning that they can just tell the program to start and when it launches it checks if it's already running, sets the running instance to visible and closing the newly launched instance again).

Giving a good answer to this is hard due to the limited information you provide though.

dbemerlin
+2  A: 

Does it make sense to create/destroy this form every time I need it, or is this an example of a situation where the form should be permanent?

1000 times a day sounds like a lot. Creating and destroying does technically consume resources and takes time, but depending on what is on the form, it might not be that much. The question about whether or not you should destroy and recreate the form really lies in how the form works. If you don't re-create it, you have to worry about putting the form back in it's original state each time. By re-creating it, this is done for you. On the flip side, f it takes several seconds to pull the data to create the form, then keeping it might be the best option. Unfortunately, the best answer is, "It depends on each scenario."

Kevin
A: 

I think this depends on if the use of the form is spread evenly during the day and if it holds any resources or handles of any kind. But if it's a simple form that's easy to re-initialize I'd probably keep it open and just hide it when needed.

ho1
A: 

That really depends on how expensive it is to create the form and on whether or not it has any side effects. If the form can be created quickly (time required is well below the detection level of the user) then it is not unreasonable to create it every time. If it is expensive to create and the users don't want to see it when it is not in use then you can just hide it when it isn't being used. However, be sure that it does not have any side effects. If it is still responding to events when it is hidden, then unexpected (usually bad) things can happen.

Bill W