Programming & Tools/Delphi

[Delphi] Edit 박스에서 숫자만 입력받기.

다크쌍피 2010. 3. 15. 17:30
OnKeyPress Event에서 Util_ChkKeyPress_VaidNum() 함수 호춤.

function Util_ChkKeyPress_VaidNum(Key:Char):Boolean;
begin
  if Key in ['0'..'9','-',#8,#9,#32,#3,#22] then // 0~9, -, Tab, BS, Space, Ctrl+C, Ctrl+V 만 유효
    result := True
  else
    result := False;
end;