Did you know… How to use F1 to get Help?

Once upon a time, a computer programmer drowned at sea.  Many <insert occupation here> were on the beach.  They heard the screams of “F1 F1”, but no one understood…

F1 can take you to a help topic based on the context of what you are currently doing.  For example, consider the language keyword class.  If I did a search for class using Search in the Microsoft Document Explorer (DExplorer) filtering on the C# Language, the first several hits refer to Class Libraries.  However, if I opened a C# project (or just create a new C# file if you’re playing along at home), place the cursor (or selected) the word class in

public class Class1 {

I get the following topic

Class (C# Programmer’s Reference)

It’s all about context.

I should also note, as it is my custom to do so, that F1 is bound to the command Help.F1Help.  There’s nothing keeping you from binding it to F2, if your heart so desires.

Happy Visual Studio’ing!

Comments (4)

  1. Norman Diamond says:

    When looking at the Error List, I would like to right-click an entry, get a popup menu and click the Help item. Many other applets under Windows do work this way, and sometimes the popup menu is only one item long containing just the Help item. (Sometimes I remember that F1 used to be Microsoft’s help key, dating from when PCs were toys and real computers had other ways of accessing help (dating from before Microsoft existed). Hitting F1 isn’t an instinctive action for many programmers and we have to happen to remember Microsoft’s style when the moment comes.)

    In addition, if I double-click an entry in the error list then the cursor moves to the corresponding position in the source file, which is very convenient and I don’t want that changed, but: If I remember to hit F1 then, it doesn’t bring up help for the error, it brings up help for what it things the syntax is. For example if there’s an error about an attribute, and I double-click the error so the cursor moves to the first character of the attribute in the source file, then F1 doesn’t bring up help for the attribute’s error message. F1 sees that the cursor is now on a square bracket so F1 brings up help about the subscript operator.

  2. tzagotta says:

    I think F1 is okay, but there is something that drives me crazy in VS2005. Suppose I compile a C# program, and there is an error reported on some of my code. If I want to invoke context sensitive help in the code editor on some portion of the offending code, I get help on the error, rather than help on the keyword in the editor. This is 99% of the time the wrong thing to do.

    If I focus in the code window and hit F1, it should always search based on the word at the cursor. If I focus the error/output window and hit F1, then I am telling the IDE I want help on the error message itself.

    What do others think?

  3. Norman Diamond says:

    Hmm. tzagotta’s comment makes me guess that VS2005 performs differently for C# than for C++.

    Anyway, an ability to right-click an error message and select help, plus an ability to right-click a keyword in the source file and select help, would be a boon for both of us. VS2005 would know where we clicked and would surely know which kind of help we’re asking for.

  4. Jeremy says:

    These are great points. Indeed, the error list and editor work differently in C# and C++ currently. C# provides the option to right click an error and choose "Show Error Help" but that option doesn’t appear in C++.

    We are looking into ways to improve entry points to Help from the Editors & Error Lists in the next version of VS, and these comments are very helpful!

    – Jeremy Jones

    Program Manager, VS Help & Community