permitir somente digitar as letras S e N
Olá pessoal!
Quero permitir que o usuário somente consiga digitar as letras S e N, estou fazendo dessa forma:
if (key <> #8) then // pra permitir o backspace
if not (key = ´S´) or (key = ´N´) then
Key := 0;
Mas não está funcionando...
Alguém pode me ajudar... sou iniciante e deve ser alguma coisa mínima q deva ser mudando, mas não sei onde.
Obrigada!
Quero permitir que o usuário somente consiga digitar as letras S e N, estou fazendo dessa forma:
if (key <> #8) then // pra permitir o backspace
if not (key = ´S´) or (key = ´N´) then
Key := 0;
Mas não está funcionando...
Alguém pode me ajudar... sou iniciante e deve ser alguma coisa mínima q deva ser mudando, mas não sei onde.
Obrigada!
Daia
Curtidas 0
Respostas
Facc
10/11/2008
no lugar de [b:363ff6ef14]if not (key = ´S´) or (key = ´N´) then [/b:363ff6ef14]tente assim
if not key in [´S´, ´N´] then procedimentos
GOSTEI 0
Daia
10/11/2008
Olá!
Fiz da forma q você sugeriu, mas tb não deu certo, ele não permite q eu digite nenhuma letra nem S, nem N, nem E, mas permite q eu apague.
procedure TFCadMov.cbESKeyPress(Sender: TObject; var Key: Char);
begin
if (key <> #8) then // pra permitir o backspace
if not (key in [´S´,´N´]) then
Key := 0;
end;
Fiz da forma q você sugeriu, mas tb não deu certo, ele não permite q eu digite nenhuma letra nem S, nem N, nem E, mas permite q eu apague.
procedure TFCadMov.cbESKeyPress(Sender: TObject; var Key: Char);
begin
if (key <> #8) then // pra permitir o backspace
if not (key in [´S´,´N´]) then
Key := 0;
end;
GOSTEI 0
Facc
10/11/2008
Olá!
Fiz da forma q você sugeriu, mas tb não deu certo, ele não permite q eu digite nenhuma letra nem S, nem N, nem E, mas permite q eu apague.
procedure TFCadMov.cbESKeyPress(Sender: TObject; var Key: Char);
begin
if (key <> #8) then // pra permitir o backspace
if not (key in [´S´,´N´]) then
Key := 0;
end;
não tenho Delphi instalado aqui. mas tente assim
procedure TFCadMov.cbESKeyPress(Sender: TObject; var Key: Char); begin if (not (key in [´S´,´N´])) and (key <> 8) then Key := 0; end;
GOSTEI 0
Daia
10/11/2008
Consegui... fiz depuração no delphi e vi que ele estava mandando letra minuscula então resolvi assim:
if (key <> #8) then // pra permitir o backspace
if not (key in [´s´,´S´,´n´,´N´]) then
Key := 0;
Muito obrigada por me ajudar.
if (key <> #8) then // pra permitir o backspace
if not (key in [´s´,´S´,´n´,´N´]) then
Key := 0;
Muito obrigada por me ajudar.
GOSTEI 0