VB.Net
  Home arrow VB.Net arrow Page 3 - Implementing The Google Web Service In VB....
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
VB.NET

Implementing The Google Web Service In VB.NET
By: Jayesh Jain
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 31
    2002-09-29

    Table of Contents:
  • Implementing The Google Web Service In VB.NET
  • The Google Web Service
  • Implementing The Google Web Service
  • Conclusion

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Implementing The Google Web Service In VB.NET - Implementing The Google Web Service


    (Page 3 of 4 )

    In the solutions explorer window, click on the web reference to see the Google web reference that we added earlier. Let's rename it to Google, by right clicking on it and clicking rename:

    Renaming our web service

    Create a user interface as shown in the image below. Add the following controls:

    a) For searching:

    txtSearch - TextBox
    lbl_TotalFound - Label
    btn_Search - Button

    b) For spell checking:

    txt_CheckSpelling - TextBox
    lbl_CorrectSpelling - Label
    btn_CheckSpelling – Button

    The layout of our form

    Type the following code into the click event of the Google search button (btn_Search):

    Private Sub btn_Search_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles btn_Search.Click

    Dim MyLicenseKey As String ' Variable to Store the License Key
    ' Declare variable for the Google search service
    Dim MyService As Google.GoogleSearchService = New _
    Google.GoogleSearchService()
    ' Declare variable for the Google Search Result
    Dim MyResult As Google.GoogleSearchResult
    ' Please Type your license key here
    MyLicenseKey = "tGCTJkYos3YItLYzI9Hg5quBRY8bGqiM"
    ' Execute Google search on the text enter and license key
    MyResult = MyService.doGoogleSearch(MyLicenseKey, _
    txtSearch.Text, 0, 1, False, "", False, "", "", "")
    ' output the total Results found
    lbl_TotalFound.Text = "Total Found : " & _
    CStr(MyResult.estimatedTotalResultsCount)
    End Sub


    Type the following code into the click event of the check spelling button (btn_CheckSpelling):

    Private Sub btn_CheckSpelling_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles btn_CheckSpelling.Click

    Dim MyLicenseKey As String ' Variable to Store the License Key
    ' Declare variable for the Google search service
    Dim MyService As Google.GoogleSearchService = New _
    Google.GoogleSearchService()
    ' Declare variable for the Google Search Result
    Dim MyResult As String
    ' Please Type your license key here
    MyLicenseKey = "tGCTJkYos3YItLYzI9Hg5quBRY8bGqiM"
    ' Execute Google search on the text enter and license key
    MyResult = MyService.doSpellingSuggestion(MyLicenseKey, _
    txt_CheckSpelling.Text)
    ' output the Results
    lbl_CorrectSpelling.Text = "Did you Mean : " & MyResult
    End Sub


    Now that we have finished coding our application, run the application and type some text into the search box and click on the google search button to see number of results found. Also test out the Google spell check.

    Our web service in action!

    And there you have it! Our web service is working as planned, and only with the implementation of a couple of lines of code!

    More VB.Net Articles
    More By Jayesh Jain


       · Just had this back from a business who has moved to Google to ViaMichelin...
     

    VB.NET ARTICLES

    - MyClass - Implementing Polymorphism in VB.Net
    - Building a News Ticker Using VB.Net
    - Everything You Wanted to Know About Forms In...
    - Building Assemblies with VB.Net
    - Simple VB.NET Notify Icon with Panel Applica...
    - Regular Expressions in .NET
    - String Encryption With Visual Basic .NET
    - Deploying Applications in VB.NET: Part 1/2
    - Watching Folder Activity in VB.NET
    - Creating A Windows Service in VB.NET
    - Implementing The Google Web Service In VB.NET
    - Migrating to Visual Basic.NET from Visual Ba...







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek