Link to home
Create AccountLog in
Avatar of leegin
leeginFlag for United States of America

asked on

C# console application to windows form application

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
SOLUTION
Avatar of burakiewicz
burakiewicz
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of leegin

ASKER

Will that give me the ability to display a progress bar, and labels with the files that are being backed up.
Avatar of Fernando Soto
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.
Yes; but as I stated in my last post it must be done through the UI thread and not the BackgroundWorker therad.
Avatar of leegin

ASKER

How about some examples or something that can help a little more. I am still very much a beginner to gui based applications.
ASKER CERTIFIED SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.