Google is the most widely used search engine. How can we build it into vs. Net? The Macro of Visual Studio. NET is used here, And the built-in Google Toolbar can be embedded in vs. net.
Create a new modle (in mymacros project) in the macro Editor (Alt + F11 open) of vs. net ),CodeSearch. VB
Imports Envdte
Imports System. Diagnostics
Imports System. Windows. Forms
Imports System. Globalization
Public Module Search
Public Sub Google ()
Navigateto ( " Http://www.google.com/search? Q = {0} " )
End sub
Private Sub Navigateto ( Byval URL As String )
Dim Selection As String = DTE. activedocument. selection. Text
If Selection. Length > 0 Then
DTE. itemoperations. navigate ( String . Format (Cultureinfo. invariantculture, URL, selection), vsnavigateoptions. vsnavigateoptionsnewwindow)
Else
MessageBox. Show ( " No search text selected. " )
End If
End sub
End Module
Add this macro to the toolbar.
For more information, see Add a search engine toolbar to vs. Net on dotnetjunkies.
Supported Chinese characters:
DTE. itemoperations. navigate (string. Format (cultureinfo. invariantculture, URL,System. Web. httputility. urlpathencode (selection )),Vsnavigateoptions. vsnavigateoptionsnewwindow)