Private Sub Button1_Click (ByVal sender As System. Object, ByVal e the As System. EventArgs) Handles for. Click
Dim vDoc, vTag
Dim As Integer I
VDoc=WebBrowser1. Document
For I=0 To vDoc. All. The length - 1
If UCase (vDoc. All (I). TagName)="INPUT" Then
VTag=vDoc. All (I)
If vTag. Type="text" Or vTag. Type="password," Then "
The Select Case vTag. Name
Case "stuid
"VTag. Value=https://bbs.csdn.net/topics/TextBox1.Text
Case "PWD"
VTag. Value=https://bbs.csdn.net/topics/TextBox2.Text
End the Select
ElseIf vTag. Type="submit" Then
VTag. Click ()
End the If
End the If
Next I
End Sub
Private Sub Form1_Load (ByVal sender As System. Object, ByVal e the As System. EventArgs) Handles MyBase. Load
WebBrowser1. Navigate (" http://web2.tust.edu.cn:7777/zhxt_bks/zhxt_bks.html ")
End Sub
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Above, is to write the code by typing textbox1 and textbox2 content, automatically fill in,
Use the button to submit,
But runtime problems, a great god to see
Problems of the code is: For I=0 To vDoc. All. The length - 1
The reason is: type was not found "HtmlElementCollection members of the public" length ", "
CodePudding user response:
You are now through the COM object rather than js calls, so1) a member of the Collection number usually should be Count property,
2) the Collection from members of the Item (I), I usually begins with 1,
CodePudding user response:
VDoc=WebBrowser1. The Document should be:The set vDoc=WebBrowser1. Document
Because vDoc is an object, the object is worth with the set, but that is changed will not reach the effect, you just don't complain,
I open the web page to see, found that framework is composed of the page, you have to set frames to visit,
To try to set vDoc=WebBrowser1. Document. Frames (1). The Document 'why is 1 in brackets, not the other, because there are three frameworks, you will automatically fill in the account password in the second, 0,
In addition the following vTag=vDoc. All (I) also want to:
The set vTag=vDoc. All (I)
Words where did you copy the code, such low-level problem should also have
CodePudding user response:
Estimation is oneself fumble. Copy to code at least can run