Intercepting Ctrl+C in a datagrid


G

Guest

I want to intercept Ctrl+C in a datagrid to prevent it performing its default
processing. I have a click selecting the entire row (its uneditable), but
only want to copy the 2nd column's value in my 2 column grid as opposed to
the entire row.

Currently with a boolean and text column I will get back
True This is the text in my column

How can I intercept Ctrl+C to stop this?
I've tried overriding a few of the keypress events but cant find the exact
right one
 
Ad

Advertisements

K

Kenneth

Howabout to override WndProc() of datagrid? (I've never tried this out
before, but it works in TextBox control)

protected override void WndProc(ref Message m)
{
switch (m.Msg)
{
case 0x0301: // WM_COPY
// Do whatever you like
break;

default:
base.WndProc (ref m);
break;
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top