Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Refreshing a textbox
Message
General information
Forum:
ASP.NET
Category:
Windows Presentation Foundation (WPF)
Environment versions
Environment:
C# 4.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01605402
Message ID:
01605408
Views:
48
>It seems that just setting Status.Text=someValue from within a click event does not (vfp) refresh until the event is completed. How can this be done (in C#) if one wants to show the status of a multistage procedure by setting the Status.Text?

If I understand correctly then you need to use a background worker to keep the UI responsive. e.g.:
var b= new BackgroundWorker();
            b.WorkerReportsProgress = true;
            b.ProgressChanged += (o, args) => { Status.Text = args.UserState.ToString(); };
            b.DoWork += (o, args) =>
                {
                    var bw = o as BackgroundWorker;
                    bw.ReportProgress(0, "Started");
                    System.Threading.Thread.Sleep(1000);
                    bw.ReportProgress(0, "Stage 1");
                    System.Threading.Thread.Sleep(1000);
                    bw.ReportProgress(0, "Stage 2");
                    System.Threading.Thread.Sleep(1000);
                    bw.ReportProgress(0, "Finished");
                };
            b.RunWorkerAsync();
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform