在VB.NET中获取HTML和href的价值 [英] Get value in HTML a href in VB.NET

查看:84
本文介绍了在VB.NET中获取HTML和href的价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在网上有一个HTML代码:

I have a html code in web:

<pre lang="HTML"><a href="value" class="inner"></a>



我希望在vb.net中获得价值。

怎么办?谢谢。谢谢。



我的尝试:




I want get "value" in vb.net.
How to do ? Help me thank.

What I have tried:

引用:

我想在vb.net中获得价值。

怎么办?帮帮我谢谢。

I want get "value" in vb.net.
How to do ? Help me thank.

推荐答案

我理解这个问题:



从代码隐藏到标记获取值的最简单方法是简单地运行元素服务器端。您可以使用任何元素执行此操作:



I think I understand the question:

The simplest way to get a value from "code behind" into the "markup" is to simply run the element server side. You can do this with any element:

<a runat="server" ID="myAnchor" href="#" class="inner"></a>





然后它会出现在代码背后:



then it will appear in the code behind:

myAnchor.HRef = "somevalue";





或类似的东西 - 我的VB非常生锈



or something similar - My VB is very rusty


有点老问题,但它可以帮助某人。



WB是WebBrowser控件的地方:



A bit old question but it can help to someone.

Where WB is a WebBrowser Control:

For Each Ele As HtmlElement In WB.Document.GetElementsByTagName("a")
    If Ele.GetAttribute("class").Contains("inner") Then
        Dim s as String = Ele.GetAttribute("href")
    End If
Next


这篇关于在VB.NET中获取HTML和href的价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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