using System.Net;
using System.Data;
private void Form1_Load(object sender, EventArgs e)
{
DataTable tbl = new DataTable();
tbl.Columns.Add("link");
WebBrowser mWB = new WebBrowser();
mWB.ScriptErrorsSuppressed = true;
WebClient wc = new WebClient();
mWB.DocumentText = wc.DownloadString("http://www.google.com");
do
{
Application.DoEvents();
}
while (mWB.ReadyState != WebBrowserReadyState.Complete);
foreach (HtmlElement item in mWB.Document.Links)
{
string strlinks = item.GetAttribute("href");
if (Convert.ToInt32(tbl.Compute("Count(link)", "Link='" + strlinks + "'")) == 0)
{
tbl.Rows.Add(strlinks);
}
}
}
using System.Data;
private void Form1_Load(object sender, EventArgs e)
{
DataTable tbl = new DataTable();
tbl.Columns.Add("link");
WebBrowser mWB = new WebBrowser();
mWB.ScriptErrorsSuppressed = true;
WebClient wc = new WebClient();
mWB.DocumentText = wc.DownloadString("http://www.google.com");
do
{
Application.DoEvents();
}
while (mWB.ReadyState != WebBrowserReadyState.Complete);
foreach (HtmlElement item in mWB.Document.Links)
{
string strlinks = item.GetAttribute("href");
if (Convert.ToInt32(tbl.Compute("Count(link)", "Link='" + strlinks + "'")) == 0)
{
tbl.Rows.Add(strlinks);
}
}
}
No comments:
Post a Comment