how to close my form well

Posted 20 March 2012 - 02:44 AM

I am coding a form that is receiving 4 video feeds from 4 ip cameras and is also receiving scale readings from two scales using seriel port comms . however when I try to close the form using me.close it freezes for a while and then closes later I wanted to know how i can go about closing it neatly. and also when I open the form again it tales a long time to open.any ideas?

Re: how to close my form well

Re: how to close my form well

Posted 20 March 2012 - 03:19 AM

thanks for the reply your idea works well. now I initialised this form while my splash form was loading but now if some one where to close the form and try to open it again it would take ages for it to open and disply the cctv footage that I want it to display and the scale readings. so closing the form works but it comes with a heavy price tag in that the form has to reload all my disposed resources all over again. any nints?

Re: how to close my form well

Posted 20 March 2012 - 03:38 AM

Actually I don't think you can speed up the execution of a program through a line of code. But you can always refactor your code. Go through it all over again and check for code where you think you can do better (Turn reusable code blocks into Functions etc) It'll optimize your program's performance.

Re: how to close my form well

Posted 11 April 2012 - 05:54 PM

I'm going to assume that you're probably using some type of threading for the video feeds or that when you are trying to close the form that the video feeds are taking longer to close. If you can abruptly stop the video feeds by cancelling any threads and then close the form it may be more responsive.