Click here to Skip to main content
Click here to Skip to main content
Alternative Tip

Tagged as

Making F1 do something useful in Visual Studio

, 14 Feb 2011
Rate this:
Please Sign up or sign in to vote.
I tried to run this the first time without any documents open and it threw an error, so I made a small mod to the original code to prevent VS from whining at me under those, probably limited, circumstances:Dim url As String = "www.google.com/search?q=MSDN"If DTE.ActiveDocument IsNot...
I tried to run this the first time without any documents open and it threw an error, so I made a small mod to the original code to prevent VS from whining at me under those, probably limited, circumstances:
 
Dim url As String = "www.google.com/search?q=MSDN"
If DTE.ActiveDocument IsNot Nothing Then
    Dim searchFor As TextSelection = DTE.ActiveDocument.Selection()
    If searchFor.Text <> "" Then
        url = "www.google.com/search?q=MSDN+" + searchFor.Text
    Else
        url = "www.google.com/search?q=MSDN"
    End If
End If
DTE.ExecuteCommand("View.URL", url)
 
I also like the idea of having it open in my browser rather than a new window in VS.
Thumbs Up | :thumbsup:
 
HmCody

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

HelenmaryC
Web Developer
United States United States
No Biography provided

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Mobile
Web04 | 2.8.140821.2 | Last Updated 14 Feb 2011
Article Copyright 2011 by HelenmaryC
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid