Solved

Window Freeze Problem

Posted on 2008-10-24
4
182 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

It is only natural that we all want our PCs to be in good working order, improved system performance, so that is exactly how programs are advertised to entice. They say things like:            •      PC crashes? Get registry cleaner to repair it!    …
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

746 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now