Click here to Skip to main content
15,905,322 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hi i am a beginner programmer in c# and little c++.
i came across a problem that is the form being frozen when my app execute a specific method (not resizable ,not movable,and not execute other methods of events).
so how can i avoid this problem.
thanks for advance.
sorry for my weak English.
Posted

nit_singh is right. If you want to perform a lengthy operation and keep your UI responsive, consider using a thread (and more specifically a BackgroundWorker). If you are using C#, this might help:
ProgressForm: A simple form linked to a BackgroundWorker[^]
 
Share this answer
 
Comments
Nish Nishant 20-Apr-11 10:53am    
Voted 5, proposed as answer.
Olivier Levrey 20-Apr-11 11:04am    
Thank you Nishant.
Nish Nishant 20-Apr-11 11:05am    
No problem, you're welcome!
mohammadrefaie 20-Apr-11 11:06am    
i don't understand how it works and how can i make my form responsive
Olivier Levrey 20-Apr-11 11:09am    
You should learn about BackgroundWorker. Try this link: http://www.codeproject.com/KB/cpp/BackgroundWorker_Threads.aspx
May be the excution of that method is time consuming thaty the form got frozen. Try to call that function async.

see the below link

Asynchronous Method Invocation[^]
 
Share this answer
 
v3
Comments
Olivier Levrey 20-Apr-11 10:47am    
Your answer is correct but providing an example would be more helpful since OP is a beginner.
Voted 4.
nit_singh 20-Apr-11 11:12am    
Thanks...
mohammadrefaie 20-Apr-11 10:56am    
can you provide an example

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900