怎么 使用vb.net获取网页表单中的数据
如何 使用vb.net获取网页表单中的数据
vb.net的form1中有一个WebBrowser1控件,程序运行时,在WebBrowser1控件会加载一个网页文件 abc.html
abc.html的代码如下:
<html><title>测试</title>
<body>
<form name="test">
您的姓名:
<input type=text name=姓名><br>
您的主页的网址:
<input type=text name=网址 value=http://><br>
密码:
<input type=password name=密码><br>
<input type=submit value="发送"><input type=reset value="重设">
</form>
</body>
</html>
问题:我能否通过vb.net获取到abc.html中 input框中所输入的文字。
------解决方案--------------------
Dim htmlTR As HtmlElementCollection
htmlTR = webbroswer1.Document.GetElementsByTagName("input")
Dim i As Integer
For i = 0 To htmlTR.Count - 1
MsgBox(htmlTR(i).GetAttribute("value"))
Next
vb.net的form1中有一个WebBrowser1控件,程序运行时,在WebBrowser1控件会加载一个网页文件 abc.html
abc.html的代码如下:
<html><title>测试</title>
<body>
<form name="test">
您的姓名:
<input type=text name=姓名><br>
您的主页的网址:
<input type=text name=网址 value=http://><br>
密码:
<input type=password name=密码><br>
<input type=submit value="发送"><input type=reset value="重设">
</form>
</body>
</html>
问题:我能否通过vb.net获取到abc.html中 input框中所输入的文字。
------解决方案--------------------
Dim htmlTR As HtmlElementCollection
htmlTR = webbroswer1.Document.GetElementsByTagName("input")
Dim i As Integer
For i = 0 To htmlTR.Count - 1
MsgBox(htmlTR(i).GetAttribute("value"))
Next