Welcome Guest.   Make a donation to an author on the site September 17, 2014, 12:34:34 PM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
Free DonationCoder.com Member Kit: Submit Request.
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: Launching Google search in Visual Basic - Help?  (Read 5019 times)
wreckedcarzz
Charter Member
***
Posts: 1,620



Happy wolfie ^_^

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« on: March 31, 2008, 05:12:11 PM »

Hey everybody,

Using the WebBrowser control, I had an issue getting a search box (returning a Null variable value). I changed it to search directly (via Google) however VB doesn't want to pass the user's search terms into the Google URL that I have. Tried quotes in every logical location, changed variables, used the {} brackets (not sure what they are called) around the variable... nothing works.

The search box (basic text box) is called txtSearch, and the variable is WebSearch. Here is the code...

[copy or print]
    Private Sub DoSearch()
        Dim WebSearch As String
        WebSearch = txtSearch.Text
        AppManager.CurrentBrowser.Navigate("http://www.google.com/search?hl=en&q=", txtSearch.Text)
    End Sub

The browser WILL go to the page, but ONLY the Google home page (because there is no search term being sent).

Can anyone help me out? It has to be simple, but I simply cannot get it! Angry tellme

-Brandon
Logged

New website! With a fancy domain name and everything! *gasp*
http://www.wreckedcarzz.com/
jazper
Coding Snacks Author
Charter Honorary Member
***
Posts: 92



View Profile WWW Give some DonationCredits to this forum member
« Reply #1 on: March 31, 2008, 08:20:39 PM »

The second argument in the navigate method is:

Quote
targetFrameName
Type: System.String

The name of the frame in which to load the document

Were you thinking it would to concatenate it to the 1st arguement?
Logged
wreckedcarzz
Charter Member
***
Posts: 1,620



Happy wolfie ^_^

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #2 on: March 31, 2008, 10:43:11 PM »

I didn't really understand what you were trying to say (its been a long day) but the browser does go to Google - it just doesn't enter the text that would logically go where txtSearch.Text is (ex: http://www.google.com/search?hl=en&q=My Awesome Search) so it (Google) kicks me back.

(Click link to see example)
« Last Edit: March 31, 2008, 10:45:26 PM by wreckedcarzz » Logged

New website! With a fancy domain name and everything! *gasp*
http://www.wreckedcarzz.com/
jazper
Coding Snacks Author
Charter Honorary Member
***
Posts: 92



View Profile WWW Give some DonationCredits to this forum member
« Reply #3 on: March 31, 2008, 11:33:48 PM »

I didn't really understand what you were trying to say (its been a long day) but the browser does go to Google - it just doesn't enter the text that would logically go where txtSearch.Text is (ex: http://www.google.com/search?hl=en&q=My Awesome Search) so it (Google) kicks me back.

(Click link to see example)

Yes, but what exactly do you think the second argument in
        AppManager.CurrentBrowser.Navigate("http://www.google.com/search?hl=en&q=", txtSearch.Text)

is doing??  Did you expect it to concatenate/append to the first argument?

Logged
wreckedcarzz
Charter Member
***
Posts: 1,620



Happy wolfie ^_^

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #4 on: April 01, 2008, 12:14:29 AM »

Yes, exactly - I figured it would (logically) work as the parameters do when launching programs (just addon) - Obviously I am incorrect, but that was my hypothesis.
Logged

New website! With a fancy domain name and everything! *gasp*
http://www.wreckedcarzz.com/
Wibble
Participant
*
Posts: 1


View Profile Give some DonationCredits to this forum member
« Reply #5 on: February 05, 2009, 03:44:26 PM »

A simple way of doing that of course for google is:
Quote
WebBrowser1.Navigate("http://www.google.com/search?hl=en&q=" + searchTextBox.Text)
Or for wikipedia:
Quote
WebBrowser2.Navigate("http://en.wikipedia.org/wiki/" + searchTextBox.Text)

Don't forget to change the red text to the search textbox and the green to the web browser.

I know its realy spimple but it works for me when i put it on a button.  Thmbsup
« Last Edit: February 05, 2009, 03:47:45 PM by Wibble » Logged
wreckedcarzz
Charter Member
***
Posts: 1,620



Happy wolfie ^_^

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #6 on: February 06, 2009, 05:27:34 PM »

Ah, alright, I'll have to try that. I managed to get Google working a while back, but the WikiPedia one is definitely cool!

Thanks for the info! smiley
Logged

New website! With a fancy domain name and everything! *gasp*
http://www.wreckedcarzz.com/
Pages: [1]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.034s | Server load: 0.21 ]