如何阻止这显示前几个字符?

时间:2012-11-30 06:11:58

标签: vb.net

如何让这一行显示它找到的前7个字符?

For Each u9 As HtmlElement In WebBrowser3.Document.GetElementsByTagName("div")
    If Not Object.ReferenceEquals(u9.GetAttribute("className"), Nothing) AndAlso u9.GetAttribute("className").Equals("duration_data") Then
        TextBox12.Text = u9.InnerText
        Exit For
    End If
Next

我认为它会进入TextBox12.Text = u9.InnerText,但我不确定是什么类型的代码。

1 个答案:

答案 0 :(得分:0)

您可以使用Substring方法实现此目的:

For Each u9 As HtmlElement In WebBrowser3.Document.GetElementsByTagName("div")
    If Not Object.ReferenceEquals(u9.GetAttribute("className"), Nothing) AndAlso    u9.GetAttribute("className").Equals("duration_data") Then
        TextBox12.Text = u9.InnerText.Substring(7)
        Exit For
    End If
Next