1
Answer

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

Vlad Penchuk

Vlad Penchuk

13y
3k
1
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:

<span id="l1" class="value ">444/1200</span>

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.

Answers (1)