Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to hide Ctrl-Del in all DBGrids?

Posted on 1998-05-22
1
Medium Priority
?
239 Views
Last Modified: 2010-04-06
Hi!
I don't want to delete my records from databases through
Ctrl-Del in DBGrid. How to hide Ctrl-Del in all DBGrids?

May be KeyPreview will help me?
0
Comment
Question by:hansmtbank
1 Comment
 
LVL 3

Accepted Solution

by:
d4jaj1 earned 150 total points
ID: 1347453
Put this in teh DBGrid's OnKeyDown event.

if ((Shift = [ssCtrl]) and (Key = VK_DELETE)) then
 begin
  key := 0;
  showmessage('Please use teh menu to delete records!);
 end;

You could put this code on the Form's OnKeyDown event, but I would suggest it.  each time teh user pressed a key (any key) it woudl have to check for this - which could slow your program down.  If your stuck on doing it this way, use ---  "and (ActiveControl is TDBGrid)"

Any questions, please add a comment.

Good Luck!  Jay
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question