Add items to the .NET Clipboard Ring from an Add-in | | How can I add a new snippet to the Visual Studio .NET IDEs Clipboard Ring? Add the following VB.NET code to the Macro IDE. In the main Visual Studio IDE, double-click on the new macro in the Macro Explorer. The two lines of code (comments) will be added to the Clipboard Ring. To change the code so it can be used in an add-in, simply replace DTE with the applicationObject. Obviously, the code being added, can be any .NET language, including C# and VB.NET.
Public Sub AddToClipring()
Dim oTB As ToolBox
Dim tabTB As ToolBoxTab
oTB = DTE.Windows.Item(Constants.vsWindowKindToolbox).Object
tabTB = oTB.ToolBoxTabs.Item("Clipboard Ring")
Dim objTbxItem As ToolBoxItem
objTbxItem = tabTB.ToolBoxItems.Add("My First Snippet", _
"' code line 1 " & vbCrLf & "' code line 2 " & vbCrLf)
End Sub
| |