我在文本文件中插入了一些網址。如何從文本文件獲取網址?
像:
www.google.com
www.facebook.com
www.twitter.com
www.yahoo.com
我想瀏覽網頁的URL格式的文本文件在C#中webBrowse1控制。
請告訴我它是如何工作的。
這是我的代碼,但它沒有工作。
try
{
FileStream fs = new FileStream("link.txt",FileMode.Open,FileAccess.Read);
StreamReader sr = new StreamReader(fs);
webBrowser1.Navigate(sr);
webBrowser1.ScriptErrorsSuppressed = true;
while (webBrowser1.ReadyState != WebBrowserReadyState.Complete)
{
Application.DoEvents();
}
}
catch(Exception)
{
MessageBox.Show("Internet Connection not found", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
this.Close();
}
幫助你自己:從來沒有_eat_例外。您正在捕獲所有異常,然後顯示一個消息框_不包含有關exception_的信息。確保你顯示'ex.ToString()'。 現在你可以告訴我,我該如何使用不同的代理使用的各個環節; – 2012-08-10 16:24:18