private void bgw_DoWork(object sender, DoWorkEventArgs e) { CheckForIllegalCrossThreadCalls = false; if (!string.IsNullOrEmpty(Table2Sync)) { foreach (string strTables in Table2Sync.Split(',')) { progressBar1.Value = 10; string TableName = strTables.ToLower().Substring(0, 3) == "tbl" ? strTables : "tbl" + strTables; lblStatus.Text = "Copying " + TableName.Replace("tbl", ""); progressBar1.Value = 50; cf.CopyTable(BranchCode, TableName, SQLClient, SQLServer); progressBar1.Value = 80; Thread.Sleep(500); progressBar1.Value = 100; } } }