求解决vb.net中length代码问题!
别人给了我一段VB的代码
Set webdoc = Web.Document
For i = 0 To webdoc.All.length - 1
If UCase(webdoc.All(i).tagname) = "INPUT" Then
Set vtag = webdoc.All(i)
If vtag.Type = "text" Then
vtag.Value = Text1.Text
End If
If vtag.Type = "password" Then
vtag.Value = Text2.Text
End If
If vtag.Value = "用 户 登 陆" Then vtag.Click
End If
Next
我翻译成vb.net时为
Dim webdoc = WebBrowser1.Document
For i = 0 To webdoc.All.length - 1
If UCase(webdoc.All(i).TagName) = "INPUT" Then
Dim vtag = webdoc.All(i)
If vtag.Type = "text" Then
vtag.Value = Form1.TextBox1.Text
End If
If vtag.Type = "password" Then
vtag.Value = Form1.TextBox2.Text
End If
If vtag.Value = "用 户 登 陆" Then vtag.Click()
End If
Next
总是提示length不是什么什么的成员
求正确翻译啊!
[解决办法]
直接取这个集合更快
webdoc.getElementsByTagName("input")