Original code:
if ActiveControl is TDBEdit then
(ActiveControl as TDBEdit).CutToClipboard
else if ActiveControl is TDBMemo then
(ActiveControl as TDBMemo).CutToClipboard;
New and improved code:
if ActiveControl is TCustomMemo then
TCustomMemo(ActiveControl).CutToClipboard;
This works the same as what you had with less overhead. TCustomMemo
is the ancestor to both TMemo and TDBMemo, so the typecast works fine.
Also, using "is" and "as" in the same statement is redundant and expensive.