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 / Languages / C# / April 2008

Tip: Looking for answers? Try searching our database.

Copy Paste Function

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
BD - 08 Apr 2008 23:20 GMT
I would like to use the keyboard shortcut 'ctrl + v' to paste from the
clipboard.  I can't seem to figure out how to capture the keyboard
input to accomplish this.  Any help is greatly appreciated.

Thanks,

BD
DrewCE - 09 Apr 2008 07:18 GMT
What are you pasting to?  I believe Ctrl-V works for textual input on
controls that include such.

-Drew

>I would like to use the keyboard shortcut 'ctrl + v' to paste from the
> clipboard.  I can't seem to figure out how to capture the keyboard
[quoted text clipped - 3 lines]
>
> BD
BD - 09 Apr 2008 17:44 GMT
> What are you pasting to?  I believe Ctrl-V works for textual input on
> controls that include such.
[quoted text clipped - 8 lines]
>
> > BD

I am pasting to multi-line textbox control.
Claes Bergefall - 09 Apr 2008 10:45 GMT
In an inherited control you usually override ProcessCmdKey and check the
input and clipboard there.

  /claes

>I would like to use the keyboard shortcut 'ctrl + v' to paste from the
> clipboard.  I can't seem to figure out how to capture the keyboard
[quoted text clipped - 3 lines]
>
> BD
BD - 09 Apr 2008 17:42 GMT
On Apr 9, 4:45 am, "Claes Bergefall" <claes.bergef...@nospam.nospam>
wrote:
> In an inherited control you usually override ProcessCmdKey and check the
> input and clipboard there.
[quoted text clipped - 8 lines]
>
> > BD

That is what I thought.  I would have to process a keydown event and
link it to a keypress event without typing the letter v.  How would I
code for that?
Claes Bergefall - 10 Apr 2008 10:46 GMT
> On Apr 9, 4:45 am, "Claes Bergefall" <claes.bergef...@nospam.nospam>
> wrote:
[quoted text clipped - 14 lines]
> link it to a keypress event without typing the letter v.  How would I
> code for that?

Uhm, no you don't, KeyDown is enough.

private void control_KeyDown(object sender, KeyEventArgs e)
{
   if(e.Control && e.KeyCode == Keys.V)
   {
       //Do your stuff here
   }
}

So I'm guessing that this is not in an inherited control then but rather
from any general control?

   /claes
BD - 16 Apr 2008 16:53 GMT
On Apr 10, 4:46 am, "Claes Bergefall" <claes.bergef...@nospam.nospam>
wrote:

> > On Apr 9, 4:45 am, "Claes Bergefall" <claes.bergef...@nospam.nospam>
> > wrote:
[quoted text clipped - 34 lines]
>
>     /claes

Sorry for replying so late, my visual studio crashed.  Yes it is just
a general control (multi line textbox).  What I was trying to do was
ctrl-C from another program (say email) and do ctrl-v in my C#
application.  I will try the above.  I was successful at trapping the
ctrl key and pasting but that breaks routine for what is generally
done.  Don't want to confuse my users any more than they are, ha ha.

Brian

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.