Restricting keyboard input

Please discuss general Delphi programming topics here.

Restricting keyboard input

Postby mixedup » December 5th, 2003, 12:20 am

Hello,

I need to restrict keyboard input to numbers only - am writing a small converter app- and haven't hit on anything that works completely. Please help . . . . .
mixedup
Member
Member
 
Posts: 1
Joined: December 5th, 2003, 12:14 am

Re: Restricting keyboard input

Postby KiteK » December 5th, 2003, 2:38 pm

Hi! Do you want code for console, or normal? If normal, and You use TEdit, write this in OnKeyPress:

Code: Select all
if not(Key in ['0'..'9']) then
begin
  Beep;
  Key := #0;
end;
KiteK
Active Member
Active Member
 
Posts: 6
Joined: November 27th, 2003, 4:05 pm


Return to Delphi Programming

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

cron