Hello
I want to read address lines from a file. I do not a user to enter URLs.
I wrote this: (Now I do not have this Error: cross-thread operation not valid: control 'txtUrl' accessed from a thread other than the thread it was created on)
String FilePath_address = Application.StartupPath + @"\address.txt";
string line = "";
// Read the file and display it line by line.
System.IO.StreamReader file = new System.IO.StreamReader(FilePath_address);
while ((line = file.ReadLine()) != null)
{
if (txtUrl.InvokeRequired)
{
txtUrl.Invoke(new MethodInvoker(delegate { line = txtUrl.Text; }));
}
//txtUrl.Text = line;
//counter++;
//}
// Create a request to the file we are downloading
webRequest = (HttpWebRequest)WebRequest.Create(txtUrl.Text);
Now I have this Error:
Invalid URI: the URI is empty.
No comments:
Post a Comment