I have tried a couple ways to get the Image, but none of them seem to work.
1st Attempt:
HtmlDocument doc = webBrowser1.Document;
HtmlElement title = doc.GetElementById("title");
HtmlElement body = doc.GetElementById("body");
HtmlElement topic = doc.GetElementById("topic-504");
HtmlElement captcha = doc.GetElementsByTagName("img")[2];
HtmlElement submit = doc.GetElementById("submit_button");
title.SetAttribute("value", textBox3.Text);
body.SetAttribute("value", textBox4.Text);
topic.InvokeMember("click");
pictureBox1.Load("http://digg.com" + captcha.GetAttribute("src"));
pictureBox1.ImageLocation = "http://digg.com" + captcha.GetAttribute("src");
2nd Attempt:
HtmlDocument doc = webBrowser1.Document;
HtmlElement title = doc.GetElementById("title");
HtmlElement body = doc.GetElementById("body");
HtmlElement topic = doc.GetElementById("topic-504");
HtmlElement captcha = doc.GetElementsByTagName("img")[2];
HtmlElement submit = doc.GetElementById("submit_button");
title.SetAttribute("value", textBox3.Text);
body.SetAttribute("value", textBox4.Text);
topic.InvokeMember("click");
String source = webBrowser1.DocumentText;
int start = source.IndexOf("<img src=\"/captcha/");
source = source.Remove(0, start);
int stop = source.IndexOf("/>");
source = source.Remove(stop.ToString().Length);
int begin = source.IndexOf("<img src=\"");
source = source.Remove(0, begin.ToString().Length);
int end = source.IndexOf("\"");
source = source.Remove(end);
pictureBox1.Load(source);
Any Ideas?

New Topic/Question
Reply




MultiQuote



|