Is there any way I can use the ProgressBar control to work with SMO as far as tracking the progress of a database operation?
Here's a code snippet:
Code: C#
Backup bkp = new Backup();
bkp.Devices.AddDevice(@"C:\test.bak", DeviceType.File);
bkp.Database = "test_db";
bkp.Action = BackupActionType.Database;
bkp.Initialize = true;
bkp.PercentCompleteNotification = 1;
bkp.PercentComplete += new
PercentCompleteEventHandler(bkp_PercentComplete);
bkp.SqlBackup(op_svr);
The problem is the handler for the PercentComplete: even though I can put the backup code inside the ProgressBar's RunTask method, the tracking of the backup's progress is handled by "PercentCompleteEventHandler", thus I never have a chance to run UpdateProgress...
Thanks in advance!