473,322 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

how to execute a google search ?

133 100+
Hello all,

I am trying to learn how to change the google search query with-in VB6 ,
in this search it is obvious that it is searching the word frog
i would like to know how to use a textbox as the souce of the query.

Sub Command1_click()

shell "C:\Program Files\Internet Explorer\IEXPLORE.EXE
http://www.google.com.au/search?hl=en&q=frog&meta="

End Sub

Thankyou for any help it will be much appreciated.
Gobblegob.
Dec 12 '07 #1
9 4644
debasisdas
8,127 Expert 4TB
You need to capture all the individual word separately from user input. Then run the query using like search after eleminating unnecessary word.
Dec 12 '07 #2
gobblegob
133 100+
You need to capture all the individual word separately from user input. Then run the query using like search after eleminating unnecessary word.
Thanks for your reply but umm... i dont know how to do it, im after an example to learn from.

Thanks
Gobblegob.
Dec 12 '07 #3
QVeen72
1,445 Expert 1GB
Hi,

It is easy if you are using a Webrowser Control,
say, you want to search for VB6 and DataGrid:
Write this Code in CommandSearch_Click event

Expand|Select|Wrap|Line Numbers
  1. WebBrowser1.Navigate2 "http://www.google.co.in/search?hl=en&q=VB6+DATAGRID&meta="
  2. DoEvents
  3.  

Regards
Veena
Dec 12 '07 #4
gobblegob
133 100+
Hi,

It is easy if you are using a Webrowser Control,
say, you want to search for VB6 and DataGrid:
Write this Code in CommandSearch_Click event

Expand|Select|Wrap|Line Numbers
  1. WebBrowser1.Navigate2 "http://www.google.co.in/search?hl=en&q=VB6+DATAGRID&meta="
  2. DoEvents
  3.  

Regards
Veena

Thanks but i understand that im trying to use a textbox as the search input on the VB6 form

Thanks
Gobblegob.
Dec 12 '07 #5
QVeen72
1,445 Expert 1GB
Hi,

OK, Say you have to search from textbox Text1
use this Code:

Expand|Select|Wrap|Line Numbers
  1. Dim TArr
  2. Dim TempStr As String
  3. Dim i As Integer
  4. TArr = Split(UCase(Text1.Text)," ")
  5. TempStr = "=" 
  6. For i = LBound(TArr) To UBound(TArr)
  7.    If Trim(TArr(i)) <> "" Then
  8.        If i = UBound(TArr) Then
  9.          TempStr =TempStr TArr(i)
  10.       Else 
  11.          TempStr =TempStr TArr(i) & "+"
  12.       End If
  13.    End If
  14. Next 
  15. TempStr = "http://www.google.co.in/search?hl=en&q" & TempStr & "&meta="
  16. WebBrowser1.Navigate2 TempStr
  17. DoEvents
  18.  

Refine the code..

Regards
Veena
Dec 12 '07 #6
gobblegob
133 100+
Hi,

OK, Say you have to search from textbox Text1
use this Code:

Expand|Select|Wrap|Line Numbers
  1. Dim TArr
  2. Dim TempStr As String
  3. Dim i As Integer
  4. TArr = Split(UCase(Text1.Text)," ")
  5. TempStr = "=" 
  6. For i = LBound(TArr) To UBound(TArr)
  7.    If Trim(TArr(i)) <> "" Then
  8.        If i = UBound(TArr) Then
  9.          TempStr =TempStr TArr(i)
  10.       Else 
  11.          TempStr =TempStr TArr(i) & "+"
  12.       End If
  13.    End If
  14. Next 
  15. TempStr = "http://www.google.co.in/search?hl=en&q" & TempStr & "&meta="
  16. WebBrowser1.Navigate2 TempStr
  17. DoEvents
  18.  

Refine the code..

Regards
Veena

Thanks for your post Veena,

but i am getting a syntax error on

TempStr =TempStr TArr(i)
Else
TempStr =TempStr TArr(i) & "+"

i've looked at it over and over but i cant see why if , if you wouldnt mind talkin me through it i would be very greatfull.

Thanks ,
Gobblegob.
Dec 13 '07 #7
gobblegob
133 100+
Thanks for your post Veena,

but i am getting a syntax error on

TempStr =TempStr TArr(i)
Else
TempStr =TempStr TArr(i) & "+"

i've looked at it over and over but i cant see why if , if you wouldnt mind talkin me through it i would be very greatfull.

Thanks ,
Gobblegob.
I worked it out all i used is this:

Dim TempStr As String
Dim TempText As String
TempText$ = Text1.Text
TempStr = "http://www.google.com.au/search?hl=en&q" & "=" & TempText & "&meta="
WebBrowser1.Navigate2 TempStr

Thanks for your help,
Gobblegob.
Dec 13 '07 #8
This is easy:

Create a text box named Textbox1

Create a web browser named webbrowser1

Create a button called Button1. This will be your "Search" button.

Copy this code



Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim search As String = TextBox1.Text

WebBrowser1.Navigate ("www.google.com.au/search?hl=en&q=" + search + "&meta=")

End Sub



Easy as that!
Jan 23 '08 #9
In VBA.

Expand|Select|Wrap|Line Numbers
  1. Sub Main()
  2.    Dim IE As Object, web_site As String
  3.  
  4.    web_site = "http://www.google.com"
  5.  
  6.    Set IE = CreateObject("InternetExplorer.Application")
  7.  
  8.    With IE
  9.       .Visible = True
  10.       .Navigate web_site
  11.    End With
  12.  
  13.    Call Wait(IE)
  14.  
  15.    IE.Document.All("q").Value = "Test"
  16.    IE.Document.All("btnG").Click
  17.  
  18.    Call Wait(IE)
  19. End Sub
  20.  
  21. Private Sub Wait(IE As Object)
  22.    While IE.Busy
  23.       DoEvents
  24.    Wend
  25.  
  26.    While IE.Document.ReadyState <> "complete"
  27.       DoEvents
  28.    Wend
  29. End Sub
Jan 23 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Fred | last post by:
I have read and tried every combination for hours. I'm sorry, but I don't get it. How do I have a form with textboxes and buttons and allow click events to execute a server function then display...
1
by: EMala | last post by:
Hello everybody! I have a problem and I dont find a answer... Please help me. I have a application, that the user log in the app, get a usersessionID, and buy the products on my virtual mall.....
3
by: Alastair | last post by:
Hello guys, I've been building a search facility for an intranet site I'm part of developing and we've been building a search engine using Index Server. It mostly works, however there have been...
3
by: Chris | last post by:
I have yet to understand or get a response on the issue I'm having. I'm taking an asp web application and migrating it from Windows 2K to 2003. I have the new website location (2003) settings...
11
by: Angelos | last post by:
Does anyone knows how to execute a PHP function using javascript.. What I want is to do that in the line bellow: <a href="" target="_blank" onClick="<? add_product_category(); ?>" >add...
2
by: jm | last post by:
I have a parent window: <script language="javascript"> function doSearch() { result=showModalDialog("searchmni.aspx?lastname=smith"); alert(result); } </script>
1
by: Mark | last post by:
I'd like to execute some code on the cleint when the user hits Enter key in a dropdown box. Another words, the user selects an item from the combo and then hits Enter key. I want to attach code to...
7
by: Rajiv Gupta | last post by:
Hi, We are moving from asp to asp.net. In our existing model we execute the asp by including them in .html files. For example: In abc.html file we include following directive: <!--exec...
7
by: JIM.H. | last post by:
Hello, Is there any difference to between SLQ string in the code and call execute query and call a stored procedure and execute the query that way concerning speed, effectiveness, reliability,...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.