We help IT Professionals succeed at work.

C# console application to windows form application

leegin
leegin asked
on
3,034 Views
Last Modified: 2013-12-17
I have a simple backup program that I wrote with the help of the experts here. It is a console application and my boss would like it to be a windows application. The console app works great, but when I migrated it to a windows app when I press the begin button the backup program starts but the interface freezes while the job is running in the background. I have posted my code please I hope I can get some feedback on what I am doing wrong.
Form1.txt
Comment
Watch Question

This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Will that give me the ability to display a progress bar, and labels with the files that are being backed up.
Fernando SotoRetired
CERTIFIED EXPERT
Distinguished Expert 2017

Commented:
As burakiewicz stated in his post the Background worker is the way to go but it is not as simple as burakiewicz stated and the reason for that is that any time you modify the UI such as labels and other controls you must do it from the UI thread and not the BackgroundWorker thread. That can be done by calling another subroutine to update the UI by calling the Control.InvokeRequired and if it is call a delegate of the UI thread to make the change.
Fernando SotoRetired
CERTIFIED EXPERT
Distinguished Expert 2017

Commented:
Yes; but as I stated in my last post it must be done through the UI thread and not the BackgroundWorker therad.

Author

Commented:
How about some examples or something that can help a little more. I am still very much a beginner to gui based applications.
Retired
CERTIFIED EXPERT
Distinguished Expert 2017
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.