By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,876 Members | 1,527 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,876 IT Pros & Developers. It's quick & easy.

Datagrid delete without a button

P: n/a
Hi,

I have a datagrid with many records, I want to delete all of them.
I'm doing CTRL-A and press delete...I take a long time to delete it and
the UI is froze during that time.

So I would like to make this delete in a worker thread, but how can I
catch the delete command before it happen??

I'm doing a windows app.

A solution I have is capture the keypress event and see if it's delete
has been pressed and if a complete row has been selected and do the
worker thread there.

But is there an event generated like on the web datagrid, that have a
DeleteCommand event.

Thanks
Frank

Nov 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi,

That's right - there's no such event. But you have another way - deriving a
new control from the grid and overriding some virtual methods.
The ones you will need are:

ProcessCmdKey
PreProcessMessage

Check for the WM_KEYDOWN message to catch the 'Del' keypress, and also check
for WM_SYSKEYDOWN sent when the user presses "Alt-Del" (yes, this shortcut
also works in the grid).

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx

"bie2" <ta******@adelphia.net> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...
Hi,

I have a datagrid with many records, I want to delete all of them.
I'm doing CTRL-A and press delete...I take a long time to delete it and
the UI is froze during that time.

So I would like to make this delete in a worker thread, but how can I
catch the delete command before it happen??

I'm doing a windows app.

A solution I have is capture the keypress event and see if it's delete
has been pressed and if a complete row has been selected and do the
worker thread there.

But is there an event generated like on the web datagrid, that have a
DeleteCommand event.

Thanks
Frank


Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.