Other Software > Developer's Corner
Launching Google search in Visual Basic - Help?
wreckedcarzz:
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...
--- --- 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! >:( :tellme:
-Brandon
jazper:
The second argument in the navigate method is:
targetFrameName
Type: System.String
The name of the frame in which to load the document
--- End quote ---
Were you thinking it would to concatenate it to the 1st arguement?
wreckedcarzz:
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)
jazper:
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)
-wreckedcarzz (March 31, 2008, 10:43 PM)
--- End quote ---
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?
wreckedcarzz:
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.
Navigation
[0] Message Index
[#] Next page
Go to full version