Solved

Window Freeze Problem

Posted on 2008-10-24
4
184 Views
Last Modified: 2013-12-17
i'm creating a desktop applicatin which will store data on server
when i'm trying to upload data on server  and when i'm move on another application and come back again my application, my application is freeze & after uploading my application is normal.  

plz help me to solve this freeze problem..
0
Comment
Question by:ranjeetcode
4 Comments
 
LVL 19

Accepted Solution

by:
drichards earned 63 total points
ID: 22794187
It appears that your upload function is blocking the rest of the app.  You should look into doing the upload on a background thread if that is the case.  Look at the BackgroundWorker class

http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx

and the ThreadPool class:

http://msdn.microsoft.com/en-us/library/system.threading.threadpool.aspx

Which one you want depends on your needs.
0
 
LVL 10

Assisted Solution

by:oxyoo
oxyoo earned 62 total points
ID: 22794198
This is due to the fact that you are executing the lengthy DB operation on the same thread that the UI uses to update the application.

When you want to perform lengthy tasks, like updates to DB, you should perform these tasks in another thread.

One way to accomplish this is to use the BackgroundWorker, here's some links for you:

Using Background Worker Component in Windows Forms
http://dotnetslackers.com/ASP_NET/re-27405_Using_Background_Worker_Component_in_Windows_Forms.aspx

BackgroundWorker Thread Use
http://dotnetperls.com/Content/BackgroundWorker-Introduction.aspx

BackgroundWorker Class
http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx


Good Luck!
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

cPanel is a Unix based web hosting control panel that provides a graphical interface and automation tools designed to simplify the process of hosting a web site. cPanel utilizes a 3 tier structure that provides functionality for administrators, rese…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question