As a Scite (Scintilla) Text Editor user, I use the keyboard shortcut of line switching ("CTRL + T") frequently. It's helpful for me in the web app development environment.

Come to dot net development months ago, I am surpised that  Visual Studio lack of this feature. Luckily, I am able to write macro for this custom function.

  1. Click Tools->Macro->Macro Explorer
  2. Browse for Samples->VSEditor n the right and double click on the file and it will start the Macro Editor Windows.
  3. Scroll right to the bottom of it, past the code at bottom into it as a new sub (function)
  4. Now, we wants to register this macro with our keyboard shortcut.
  5. Back to Visual Studio, click Tools->Options->Environment->Keyboard
  6. Type 'switchline' in the textbox under 'Show commands containing:'
  7. You will see a highligthed 'Macros.Samples.VSEditor.SwitchLine', make sure it is selected.
  8. Select 'Text Editor' under 'Use new shortcut in'
  9. Move your cursor into the textbox of 'Press shortcut keys', hold down "CTRL" & "T" on your keyboard.
  10. Click OK and now it is done. Enjoy coding!
    Sub SwitchLine()
        Dim thisLine As String
        Dim lastLine As String

        ' get current line, set cursor to start of line
        DTE.ActiveDocument.Selection.StartOfLine(0)
        ' set cursor to end of line
        DTE.ActiveDocument.Selection.EndOfLine(True)
        ' copy the selection into thisLine
        thisLine = DTE.ActiveDocument.Selection.Text
        ' set cursor to end of line
        DTE.ActiveDocument.Selection.EndOfLine()

        'set cursor to last line
        DTE.ActiveDocument.Selection.lineUp()
        'set cursor to start of line of this lastline
        DTE.ActiveDocument.Selection.StartOfLine(0)
        ' set cursor to end of line
        DTE.ActiveDocument.Selection.EndOfLine(True)
        ' copy the selection into thisLine
        lastLine = DTE.ActiveDocument.Selection.Text
        ' set cursor to end of line
        DTE.ActiveDocument.Selection.EndOfLine()

        ' copy this line text to last line
        DTE.ActiveDocument.Selection.StartOfLine(0)
        DTE.ActiveDocument.Selection.EndOfLine(True)
        DTE.ActiveDocument.Selection.Text = thisLine
        DTE.ActiveDocument.Selection.EndOfLine()

        'copy last line text to this line
        DTE.ActiveDocument.Selection.lineDown()
        DTE.ActiveDocument.Selection.StartOfLine(0)
        DTE.ActiveDocument.Selection.EndOfLine(True)
        DTE.ActiveDocument.Selection.Text = lastLine
        DTE.ActiveDocument.Selection.EndOfLine()

    End Sub