Hi,
I posted an earilier post vb6 and shellexecute to accomplish my task but think this is better with the webrowser control.
I have to do a search with vb6 and somehow open up the third url on the search page.
On the form there is
textbox = search criteria
command button search
combobox = search engines listed (Google,MSN,Alt avista)
webbrowser to hold the page.
I have never worked with this control and can't seem to figure out how to enter the search text, select the search engine click the show url button and have the third url on the search page to open up that web site.
CODE IS BELOW:
Private Sub Command1_Click( )
If Text1.Text <> "" And Combo1.Text <> "SELECT ONE" Then
Select Case Combo1.Text
'holdstring = ShellExecute(0& , "open", "http://www.google.co.u k/search?as_q=dog s&hl=en&rlz=1T4 GGLJ_en-GBGB232GB233&nu m=1&start=2", "", vbNullString, 1)
Case "ALTAVISTA"
URLTOSEARCH = "http://www.altavista.c om/web/results?itag=od y&pg=aq&aqmode= s&aqa=" & Text1.Text & "&aqp=&aqo=&aqn =&kgs=1&kls=0&d t=tmperiod&d2=0 &dfr%5Bd%5D=1&d fr%5Bm%5D=1&dfr %5By%5D=1980&dt o%5Bd%5D=15&dto %5Bm%5D=8&dto%5 By%5D=2007&file type=&rc=dmn&sw d=&lh=1&nbq=3"
Case "GOOGLE"
URLTOSEARCH = "http://www.google.co.u k/search?as_q= " & Text1.Text & "&hl=en&rlz=1T4 GGLJ_en-GBGB232GB233&nu m=1&start=2&btn G=Google+Search &as_epq=&as_oq= &as_eq=&lr=&as_ ft=i&as_filetyp e=&as_qdr=all&a s_occt=any&as_d t=i&as_sitesear ch=&as_rights=& safe=images"
Case "MSN"
URLTOSEARCH = "http://search.live.com/results.aspx?q= " & Text1.Text & "&mkt=en-us&FORM=LIVSOP& go.x=1&go.y=3"
End Select
Else
MsgBox "PLEASE SELECT YOUR SEARCH AND ENTER SEARCH CRITERIA"
End If
WebBrowser1.Nav igate (URLTOSEARCH)
Dim Doc As HTMLDocument
Set Doc = WebBrowser1.Doc ument
***** THIS IS WHERE I WENT THROUGH THE LINKS ON THE SEARCH PAGE ***********THAT WAS LOADED BY ,WebBrowser1.Na vigate *************** ***(URLTOSEARCH )
Dim i As Integer
THETOTAL = WebBrowser1.Doc ument.links.len gth
For i = 0 To THETOTAL
MsgBox WebBrowser1.Doc .links(i).href & i
Next
End Sub
I don't need the search page to be loaded, somehow the third url sites is what is to open.
If anybody has any ideas that would be greatly appreciated.
Thanks,
SB
I posted an earilier post vb6 and shellexecute to accomplish my task but think this is better with the webrowser control.
I have to do a search with vb6 and somehow open up the third url on the search page.
On the form there is
textbox = search criteria
command button search
combobox = search engines listed (Google,MSN,Alt avista)
webbrowser to hold the page.
I have never worked with this control and can't seem to figure out how to enter the search text, select the search engine click the show url button and have the third url on the search page to open up that web site.
CODE IS BELOW:
Private Sub Command1_Click( )
If Text1.Text <> "" And Combo1.Text <> "SELECT ONE" Then
Select Case Combo1.Text
'holdstring = ShellExecute(0& , "open", "http://www.google.co.u k/search?as_q=dog s&hl=en&rlz=1T4 GGLJ_en-GBGB232GB233&nu m=1&start=2", "", vbNullString, 1)
Case "ALTAVISTA"
URLTOSEARCH = "http://www.altavista.c om/web/results?itag=od y&pg=aq&aqmode= s&aqa=" & Text1.Text & "&aqp=&aqo=&aqn =&kgs=1&kls=0&d t=tmperiod&d2=0 &dfr%5Bd%5D=1&d fr%5Bm%5D=1&dfr %5By%5D=1980&dt o%5Bd%5D=15&dto %5Bm%5D=8&dto%5 By%5D=2007&file type=&rc=dmn&sw d=&lh=1&nbq=3"
Case "GOOGLE"
URLTOSEARCH = "http://www.google.co.u k/search?as_q= " & Text1.Text & "&hl=en&rlz=1T4 GGLJ_en-GBGB232GB233&nu m=1&start=2&btn G=Google+Search &as_epq=&as_oq= &as_eq=&lr=&as_ ft=i&as_filetyp e=&as_qdr=all&a s_occt=any&as_d t=i&as_sitesear ch=&as_rights=& safe=images"
Case "MSN"
URLTOSEARCH = "http://search.live.com/results.aspx?q= " & Text1.Text & "&mkt=en-us&FORM=LIVSOP& go.x=1&go.y=3"
End Select
Else
MsgBox "PLEASE SELECT YOUR SEARCH AND ENTER SEARCH CRITERIA"
End If
WebBrowser1.Nav igate (URLTOSEARCH)
Dim Doc As HTMLDocument
Set Doc = WebBrowser1.Doc ument
***** THIS IS WHERE I WENT THROUGH THE LINKS ON THE SEARCH PAGE ***********THAT WAS LOADED BY ,WebBrowser1.Na vigate *************** ***(URLTOSEARCH )
Dim i As Integer
THETOTAL = WebBrowser1.Doc ument.links.len gth
For i = 0 To THETOTAL
MsgBox WebBrowser1.Doc .links(i).href & i
Next
End Sub
I don't need the search page to be loaded, somehow the third url sites is what is to open.
If anybody has any ideas that would be greatly appreciated.
Thanks,
SB