troubleshooting Question

WebClient().DownloadString() blocks and I can't give user feedback

Avatar of trippy1976
trippy1976Flag for United States of America asked on
MySQL Server.NET ProgrammingC#
6 Comments1 Solution1408 ViewsLast Modified:
First time out using WebClient().DownloadString() to get data from a web page.

It works, but I have a label I want to set to something like "Loading Information..." before the download happens.  This is because it takes a few moments for the call to complete.  In this time, it looks like the app has hung to the user.

Despite setting the label prior to making this call, it does not show until AFTER the call completes.

this.status_label.Text = "Loading information...";
this.status_label.BackColor = Color.Green;
this.status_label.ForeColor = Color.White;             
var response = new WebClient().DownloadString("");

This is the code.  Simple enough, but the status_label text and color only change after the downloadstring call completes.

Can I put up some kind of hourglass or notice or progress bar so the user knows something is working?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 6 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros