Ver Mensaje Individual
  #6  
Antiguo 19-11-2008
fidel fidel is offline
Miembro
 
Registrado: mar 2005
Posts: 381
Reputación: 22
fidel Va por buen camino
En el evento OnKeyPress del edit
Código Delphi [-]
//entrar solo números ECantidad
procedure TFContabilidad.ECantidadKeyPress(Sender: TObject; var Key: Char);
var
  i: integer;
begin
  //controlar entrada solo números
  if ( StrScan('0123456789.'+chr(7)+chr(8), Key) = nil ) then  Key := #0;
  //cambiar punto decimal por coma
  if key = '.' then key := ',';
  //controlar entrada una sola coma
  for i := 1 to length(ECantidad.Text) do
    if ( copy(ECantidad.Text,i,1) = ',' ) and not ( StrScan(',', Key) = nil ) then  Key := #0;
end;
Responder Con Cita