I transferred VB.Net
app to C#
and when I build it. This error showed up -
'mshtml.IHTMLImgElement' does not contain a definition for 'getattribute' and no extension method 'getattribute' accepting a first argument of type 'mshtml.IHTMLImgElement' could be found (are you missing a using directive or an assembly reference?)
So how can I replace this getattribute
call?
This is the code
private void captcha()
{
mshtml.IHTMLDocument2 doc = (mshtml.IHTMLDocument2) WebBrowser1.Document.DomDocument;
mshtml.IHTMLControlRange imgrange = (mshtml.IHTMLControlRange) (((mshtml.HTMLBody) doc.body).createControlRange());
foreach (mshtml.IHTMLImgElement img in doc.images)
{
if (img.getattribute("src").ToString().Contains("urltoimg"))
{
imgrange.add((mshtml.IHTMLControlElement) img);
imgrange.execCommand("copy", false, null);
PictureBox1.Image = (System.Drawing.Image) (Clipboard.GetDataObject().GetData(DataFormats.Bitmap));
break;
}
}
}
Try "GetAttribute". VB is case-insensitive, so "getattribute" would work in VB, however C# (and virtually every other language) is case-sensitive.