I am working on a desktop application in which i have to transfer a large amount of data from one db to another.I want to show the details of record transfered in a text box dynamically. i am using following code
After insertion in db following code is executed:
if (val >= 0)
{
Transfercounter++;
saving = "Record " + Transfercounter + " is transferred to new DB";
txtResults.Text = txtResults.Text + saving + Environment.NewLine + Environment.NewLine;
}
How to show the transfered record dynamically at run time instead of showing all records after the execution completes.
Like Dan Hunex says, you should use the BackgroundWorker approach with ProgressBar and a text box showing status:
Steps
Put your SQL in a BackgroundWorker. Great examples on MSDN and is not hard to use.
When you call the BackgroundWorker, that frees up your UI to run some kind of "Status" control.
Once the BackgroundWorker’s RunWorkerCompleted happens, you can remove your "Status" control and bind up your data or whatever
Further