RRRouter

Say I want to rename 40 controls. That will be a lot of clicking in the design window. Is there any shortcut for renaming controls.

Something like: mark control + F2 + write new name

Is there something like that


Re: Windows Forms Data Controls and Databinding Shortcut to rename controls?

Brendan Grant

If you are running Visual Studio 2005 or better you might try looking in the .Designer.cs or .Designer.vb file, scroll to the bottom and there you'll have a list of all of the controls on your form... from there you could click right click on each and choose Rename under VB.NET or Refactor->Rename to do so.

Not much easier... but at least there you've got an ordered list of what needs renaming.






Re: Windows Forms Data Controls and Databinding Shortcut to rename controls?

Yu Guo – MSFT

Hi, RRRouter,

Based on my understanding, you want to find a hotkey for defining new name of a control, am I right

As far as I can see, there is not such hotkey exists in Visual Studio.

However, I think you can achieve your goal with Macro.

First, open your Macro Window with Alt+F8, right click on a Module and choose "New Macro".

Input the following codes

Code Snippet

Public Module Module1

Sub Macro1()

DTE.Windows.Item(Constants.vsWindowKindProperties).Activate()

End Sub

End Module

Save this Macro, and then go to Option in Tool menu, you can set any hotkey to this Macro in Environment->Keyboard. Before using this Marco, please set the (Name) property as the selected property in Property Window.

Then you can click your control, click HotKey, and input the Name.

More information about Macro,

http://msdn2.microsoft.com/en-us/library/b4c73967(VS.80).aspx

Hope this helps,

Regards