.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Visual Studio replace

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
Ed.Jobe
175 Views, 4 Replies

Visual Studio replace

You know how in VS, when you put your cursor on a variable, it highlights all the variable occurrences? When I rename a variable, is there a shortcut to get VS to rename all the occurrences at once?

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

4 REPLIES 4
Message 2 of 5
ActivistInvestor
in reply to: Ed.Jobe

Put the cursor on the variable identifier, and press F2

Message 3 of 5
Ed.Jobe
in reply to: ActivistInvestor

...That doesn't seem to do anything for me. I tried putting the cursor in the middle of the var name, hit F2 and started typing, but it didn't do anything. It just put red squiggles under the other occurrences.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

Message 4 of 5

It could have something to do with changing your key bindings. 

 

On a default installation of Visual Studio, when I put the cursor on an identifier and press F2, I see this:

 

PressF2.png

 

You can also right-click and choose "Rename" from the context menu.

 

Message 5 of 5
Ed.Jobe
in reply to: ActivistInvestor


@ActivistInvestor wrote:

You can also right-click and choose "Rename" from the context menu.

 


Oh, that one works. Nice! As for F2, I'm working from home right now on a laptop remoting to my work pc. Perhaps it's an rdp thing. I'll try F2 when I get back in the office.

 

edit: You gave me an idea. I went to options and found that it's command Refactor.Rename. My keyboard map (Default) is mapped to Ctrl+R. You're probably using VS pro. I'm using Community.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report