New to VB2005 some help please

newprogram

New member
Joined
Sep 9, 2006
Messages
3
Programming Experience
Beginner
Hi im new to this forum and to vb2005 iv used alot of vb6 but this is kind of confusing for me in vb6 to fill in a forum on a webpage I used this
WebBrowser1.Document.getElementById("q").Value = "me"
or

Dim HTMLI As HTMLInputElement
Dim HTML As HTMLDocument
Set HTML = WebBrowser1.Document
Debug.Print HTML.documentElement.innerText
If InStr(HTML.documentElement.innerText, "One or more fields are missing or incorrect") Then Exit Sub
For Each HTMLI In HTML.getElementsByTagName("input")
If HTMLI.Name = "q" Then
HTMLI.Value = Text2
ElseIf HTMLI.Name = "btnG" Then
HTMLI.Click




How do I do this in vb2005?
 
basically the same exact way.
1. Add the referance to the axwebbrowser control
2. then

dim webbrowser1 as new axwebbrowser
webbrowser1.navigate(http://mysite.com/)
WebBrowser1.Document.getElementById("q").Value = "me"
WebBrowser1.Document.getElementById("btng").click()
 
Cant find axwebbrowser control in the add referance im using vb2005 were is it?
basically the same exact way.
1. Add the referance to the axwebbrowser control
2. then

dim webbrowser1 as new axwebbrowser
webbrowser1.navigate(http://mysite.com/)
WebBrowser1.Document.getElementById("q").Value = "me"
WebBrowser1.Document.getElementById("btng").click()
 
It is probably listed as

Microsoft Web Browser cotnrol,
SHDocVw.dll is the actual name of the file but if it's not listed just search your windows dir for it.

Heres some code to make your life easier, just make sure to drag the newly added control onto your form from the toolbox in vs.net. The following code assumes you named your control axweb.

private sub login()
axweb.visible = false 'this just makes the browser hidden
'until it has logged on.
Dim oURL As Object = "http://Mysite.com/login.html"
With AxWeb
.Navigate(oURL)
While Not Me.AxWeb.ReadyState = SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE
Application.DoEvents()
End While

.Document.getelementbyid("txtUsername").Value = "Admin"
.Document.getelementbyid("txtPassword").Value = "1234"
.Document.getelementbyid("btnLogin").click()


While Not Me.Axweb.ReadyState = SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE
Application.DoEvents()
End While
End If
End With

'sb.Text = "Ready.."

Catch ex As Exception
MsgBox(ex.Message)
AxWeb.Dispose()
Me.Dispose()
End Try
Axweb.Visible = True
End Sub
 
Back
Top