如何从网页上获取号码?如何将一串数字分隔成多个按钮? [英] how to get a number from a webpage? How to separate a string of numbers into buttons?

查看:115
本文介绍了如何从网页上获取号码?如何将一串数字分隔成多个按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从网页上获取一个数字,或者只是一个文本.
我通常使用:

I need to get a number, or just text for that matter, from a webpage.
I normally use:

HtmlElement value = wb.Document.All["village_map"];
            value.GetAttribute("level");
            UpgradeWood.Text = value.InnerText;


wb是我的网络浏览器.
乡村地图是我想要的对象的ID,
级别是对象的类. -这就是我需要的
UpgradeWood是一个按钮

我需要这个等级"的值

但是,在"village_map"上,大约有15个级别"的
所以我最终得到了所有人.如下所示:233223222323323222尽管看起来好像它们没有任何模式.
最后,我的目标是让每个按钮都具有这些数字.
button1应该有2
button2应该有3
button3应该有3
button4应该有2
等等...
我几乎需要一些将这些数字分开并将其应用到按钮中的东西.
在此先感谢.

这是我在Google图片上找到的图片..
http://bit.ly/jOXdDy [ ^ ]


wb is my web browser.
Village map is the ID of the object i want,
level is the class of the object. --this is what i need
UpgradeWood is a button

I need the value of this "level"

however, on "village_map" there are about 15 "level"''s
so I end up getting all of them. as follows: 233223222323323222 they are not in any pattern although it may seem so.
my goal in the end is for each button i have, to have on of these numbers.
button1 should have 2
button2 should have 3
button3 should have 3
button4 should have 2
and so on...
pretty much i need something that will separate these numbers and apply them into buttons.
thanks in advance.

heres a pic i found on google images..
http://bit.ly/jOXdDy[^]

推荐答案

在您后面的代码中,只需对数字字符串执行foreach并将每个连续的字符分配给适当的按钮.
In your code behind just perform a foreach on the string of numbers and assign each consecutive character to the appropriate button.


这篇关于如何从网页上获取号码?如何将一串数字分隔成多个按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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