Skip to content

HELP ME!! C# Cannot implicitly convert type 'System.Windows.Forms.HtmlElem… to 'string'

Vlad Penchuk

Asked Jun 8, 2011, 12:23 AM EDT1 answer
Share
LinkedInX
i dont know how to fix this.. thanks!!

woodproduction is my variable.
wb is my web browser.
l1 is the ID of a value.
value is the value of l1.
woodprodval is a label i wish to place the value of l1.
l1 is a number. it changes every hour.
when a user clicks the refresh button this script will run and try to load that l1 number into the label's text..


HtmlElement woodproduction = wb.Document.All["l1"];
woodproduction.GetAttribute("value ");
woodprodval.Text = (woodproduction); // <<--error


Cannot implicitly convert type 'System.Windows.Forms.HtmlElement' to 'string'.

the page's line of HTML looks like this:

444/1200

and the page visible to my eye shows:

444/1200

the current number is 444. that is the number i am in need of fetching.

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    THIS IS SOLVED! ADD: change the last line to: woodprodval.Text = woodproduction.InnerText;
    0