Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / IDE / March 2006

Tip: Looking for answers? Try searching our database.

VS2005: How to disable cut & copy without selection?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SergeK - 10 Mar 2006 05:54 GMT
In the VS6 it was optional "extra feature".
Then, apparently, someone decided that it is "the only right thing" for VS.
NET 2003. Well, I and everyone I work with hates it...
It seems to be the same in VS.NET 2005.
There is an option "Apply Cut or Copy commands to blank lines when there is
no selection", but it doesn't turn it off completely and just makes its
behaviour even more confusing.
Is there a way to get rid of this "feature"?
Thanks.
Carlos J. Quintero [VB MVP] - 10 Mar 2006 09:21 GMT
Hi Serge,

AFAIK, there is no direct way, but you can create a macro or add-in like
this (not tested and not optimized) to intercept the Edit.Copy command and
cancel it if there is no selection:

Private Sub CommandEvents_BeforeExecute(ByVal Guid As String, ByVal ID As
Integer, ByVal CustomIn As Object, _
   ByVal CustomOut As Object, ByRef CancelDefault As Boolean) _
   Handles CommandEvents.BeforeExecute

     Dim objCommand As Command
     Dim objTextDocument As TextDocument

     objCommand = DTE.Commands.Item(Guid, ID)
     If objCommand.Name = "Edit.Copy" Then
        Try
           objTextDocument = Ctype( DTE.ActiveWindow.Document.Object,
EnvDTE.TextDocument
           If
objTextDocument.Selection.TopPoint.EqualTo(objTextDocument.Selection.BottomPoint)
Then
              CancelDefault = True
           End If
        Catch ex As System.Exception
        End Try
     End If

End Sub
Signature


Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio
You can code, design and document much faster:
http://www.mztools.com

> In the VS6 it was optional "extra feature".
> Then, apparently, someone decided that it is "the only right thing" for
[quoted text clipped - 7 lines]
> Is there a way to get rid of this "feature"?
> Thanks.
SergeK - 11 Mar 2006 03:39 GMT
Thanks, I'll give it a try.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.