hey!, i guess you wanna download some file from internet to the computer.. you can use WebClient class which is System.Net namespace, heres the code:
-
-
private void Download(string URL, string SaveTo)
-
{
-
//URL = URL of the file to download, dont forget to add http://www. before it...
-
//SaveTo = Address of the location to save the downloaded file...
-
System.Net.WebClient w = new System.Net.WebClient();
-
w.DownloadProgressChanged += new System.Net.DownloadProgressChangedEventHandler(w_DownloadProgressChanged);
-
w.DownloadFileCompleted += new AsyncCompletedEventHandler(w_DownloadFileCompleted);
-
w.DownloadFileAsync(new Uri(URL), SaveTo);
-
}
-
-
void w_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
-
{
-
//...do anything here when the download starts...
-
}
-
-
void w_DownloadProgressChanged(object sender, System.Net.DownloadProgressChangedEventArgs e)
-
{
-
//...do anything here when progress changes of the download, you can use the e.ProgressPercentage to get the percentage of progress done
-
}
You can remove the line
- w.DownloadProgressChanged += new System.Net.DownloadProgressChangedEventHandler(w_DownloadProgressChanged);
if you dont want to do anything on progress changed...also delete the event for it.
You can also remove the line
- w.DownloadFileCompleted += new AsyncCompletedEventHandler(w_DownloadFileCompleted);
if you dont want to do anything when the download is completed...also delete the event for it.
Hope this helps :) I really dont know any way of directly reading XML from the InterWebz, but after downloading XML with this code you can read/write/edit the XML since it will be on your local hard disk.