segunda-feira, 19 de janeiro de 2009

Forçar um Edit a Aceitar Só Letras ou Só Números

No evento OnKeyPress do Edit.

Só números:
if not (Key in['0'..'9',Chr(8)]) and (Key #13) and (Key #8) then
Key := #0;

Só letras:

if (Key in['0'..'9',Chr(8)]) and (Key #13) and (Key #8) then
Key := #0;

Nenhum comentário: