views:

237

answers:

1

In Visual Studio, there is a handy IDE shortcut for directly jumping to a file, i.e.

CTRL-/ (to select the Find combo-box) Then type in ">open myclass.cs"

This is much quicker than navigating through the Solution explorer to open the specified class.

However, if you try and open the code part of a form (not the designer part) in this way then Visual Studio simply returns "The operation could not be completed".

...which means that I have to go through the Solution explorer to open them.

Is there any way to get this shortcut to work for forms, or is there some other shortcut?

Update: the problem seems to be with intellisense...

If I type ">open form1.cs" then this works...

But if I type ">open form" and then use the up and down keys to select from the intellisense, so that the combo reads ">open "Form1.cs (OpenShortcutTest)"" then that operation will fail.

+1  A: 

Why not just use F7 to view the code behind? Maybe I'm missing something?

[edit]I just tried it in VS 2008 and ">open form2.cs" works fine.[/edit]

John
To use F7 you first have to highlight the file in the Solution Explorer, which is a lot slower than using the ">open" shortcut - for us at least where are solution is very large with multiple projects.Not sure why ">open" on forms works for you. Are your forms made of 3 parts? e.g. ...
RickL
form2.cs, form2.Designer.cs and form2.resx? i.e. it was automatically generated by Visual Studio 2005/2008 and uses partial classes? I think that is something to do with the problem.
RickL
(in the 1st comment I meant that "our" solution is very large... i.e. 50+ projects, and the forms are often nested inside folders... so to navigate through the GUI to a form will involve multiple clicks and scrolls).
RickL
I just did a new windows forms project and added a few forms through Visual Studio and then did the shortcut you mentioned and it worked fine. The reason I mentioned f7 is because I thought you had the form open in design view and wanted to quickly get to the code behind.
John
Have accepted your answer as it helped me realise the problem was with the intellisense.
RickL