I'm finding the built-in Visual Studio Document Explorer less relevant, especially as more of the SDKs I work with have the most up-to-date content on-line. Pressing F1 starts Document Explorer usually with something unhelpful and it's not usable any more for me.
Is there any way that on the press of a key combination in Visual Studio:
site:msdn.microsoft.com
I don't know anything about macros in VS but presumably that's what I need. Does anyone know how to go about setting this up? teh codez would be nice!
Run the current page in a browser instance inside of Visual Studio. Right-click a blank area of the page and then click View in Browser. The View in Browser command is not available for files that do not render in a browser (such as the Web.
Here is another version (based on Alex's answer) that will also select the current word you are on. More like the typical F1 help.
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports System.Diagnostics
Public Module Search
Sub GoogleSearch()
AnySearch("http://www.google.com/search?q=.net+")
End Sub
Sub BingSearch()
AnySearch("http://www.bing.com/search?q=")
End Sub
Private Sub AnySearch(ByVal searchUrl)
Dim strUrl As String
Dim selection As String = GetSelection()
If selection <> "" Then
strUrl = searchUrl + selection
DTE.ExecuteCommand("nav", strUrl & " /ext")
Else
MsgBox("Select text to search for.")
End If
End Sub
Private Function GetSelection() As String
Dim selection As TextSelection = DTE.ActiveDocument.Selection()
If selection.Text <> "" Then
Return selection.Text
Else
DTE.ExecuteCommand("Edit.SelectCurrentWord")
selection = DTE.ActiveDocument.Selection()
Return selection.Text
End If
End Function
End Module
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With