C#无法将类型'System.Windows.Forms.HtmlElement'隐式转换为'string' [英] C# Cannot implicitly convert type 'System.Windows.Forms.HtmlElement' to 'string'

查看:67
本文介绍了C#无法将类型'System.Windows.Forms.HtmlElement'隐式转换为'string'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道该如何解决..谢谢!

木材生产是我的变数.
wb是我的网络浏览器.
l1是值的ID.
value是l1的值.
woodprodval是我希望放置l1值的标签.
l1是一个数字.它每小时都会变化.
当用户单击刷新按钮时,此脚本将运行并尝试将l1号加载到标签的文本中.

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);


无法将类型"System.Windows.Forms.HtmlElement"隐式转换为字符串".

该页面的HTML行如下所示:

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

而我眼中可见的页面是:

444/1200

当前号码是444.这是我需要提取的号码.


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 is:

444/1200

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

推荐答案

尝试使用woodprodval.Text = woodproduction.InnerText;


这篇关于C#无法将类型'System.Windows.Forms.HtmlElement'隐式转换为'string'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆