Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 613353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:59:37+00:00 2026-05-13T17:59:37+00:00

Is there a shortcut for Duplicate Line command in Visual Studio 2008? Some similar

  • 0

Is there a shortcut for Duplicate Line command in Visual Studio 2008?

Some similar examples:

  • in Notepad++, I can duplicate the current line with: Ctrl+D
  • in EditPlus: Ctrl+J
  • in NetBeans: Ctrl+Shift+↓/↑
  • in Eclipse, Ctrl+Alt+↓/↑
  • in Vi/Vim, yyp
  • etc.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T17:59:37+00:00Added an answer on May 13, 2026 at 5:59 pm

    In Visual Studio 2022

    Ctrl + E, V

    In Visual Studio 2019

    Ctrl + D

    In Visual Studio 2017 (v15.6 and after)

    Ctrl + D

    In Visual Studio 2017 (pre v15.6)

    (edit) This feature is now built-in in VS2017: Ctrl + E, V duplicates a line if nothing is selected, or duplicates selection. You can assign it to a different key combination, or find it in the menu:

    Duplicate line in VS2017

    See this reference for more information.

    Pre VS2017, built-in method using clipboard

    As @cand mentioned, you can just do Ctrl + C ; Ctrl + V.

    Ctrl + C will copy the line if nothing is selected.

    Macro solution (pre VS2017)

    If you’d like to implement a more complete solution, perhaps to create a simpler keyboard shortcut or you don’t want to effect the clipboard, see this guide:

    Visual Basic:

    Imports System
    Imports EnvDTE
    Imports EnvDTE80
    Imports System.Diagnostics
     
    Public Module DuplicateLastLineModule
        Sub DuplicateLine()
            Dim line As String
            DTE.ActiveDocument.Selection.StartOfLine(0)
            DTE.ActiveDocument.Selection.EndOfLine(True)
            line = DTE.ActiveDocument.Selection.Text
            DTE.ActiveDocument.Selection.EndOfLine()
            DTE.ActiveDocument.Selection.NewLine()
            DTE.ActiveDocument.Selection.StartOfLine(0)
            DTE.ActiveDocument.Selection.Text = line
        End Sub
    End Module
    

    To create the macro, just go to the macro explorer
    ("Tools->Macros->Macro Explorer" or Alt+F8) and copy paste the code in
    a new module. Now just assign a keyboard shortcut to it:

    1. go to Tools->Options…
    2. under Environment, click Keyboard
    3. in the "Show Commands Containing" textbox, enter "duplicate" (this according to the name you gave the module.)
    4. you should now see the macro in the list below
    5. choose "Text Editor" from the "Use new shortcut in" list
    6. set focus in the "Press shortcut keys" textbox and hit the combination on the keyboard you wish to use for it (Ctrl+Shift+D in
      my case)
    7. hit the "Assign" button
    8. you should now see the shortcut in the "Shortcuts for selected command" textbox
    9. hit the OK button

    And that’s it. Enjoy!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 357k
  • Answers 357k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The other answers are correct. Here is some code you… May 14, 2026 at 9:40 am
  • Editorial Team
    Editorial Team added an answer you ruin the noConflict concept by reassigning the jquery to… May 14, 2026 at 9:40 am
  • Editorial Team
    Editorial Team added an answer If you get that particular error, you don't actually have… May 14, 2026 at 9:40 am

Related Questions

No related questions found

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.