Fórum Erro no Locate de números decimais. #391238
25/11/2010
0
var
V, W :Double;
begin
V:=(StrToFloat(EditAngulo.Text));
W:=Trunc(V);
Edit10.Text:=FloatToStr(W);
if TabAnguloposte.locate('angulo',EditAngulo.text,[]) then
begin Edit11.Text:=TabAnguloposte.FieldByName('Pesoposte').AsFloat;
end;
end; Se algum de vocês puderem me ajudar, desde já eu agradeço. Atenciosamente. Valdir Lima
Valdir Lima
Curtir tópico
+ 0Posts
25/11/2010
Leonardo Xavier
Gostei + 0
25/11/2010
Valdir Lima
Gostei + 0
25/11/2010
Leonardo Xavier
var
V, W :Double;
begin
V:=(StrToFloat(EditAngulo.Text));
W:=Trunc(V);
Edit10.Text:=FloatToStr(W);
if TabAnguloposte.locate('angulo',EditAngulo.text,[]) then
begin Edit11.Text:=TabAnguloposte.FieldByName('Pesoposte').AsFloat;
end;
end; Se algum de vocês puderem me ajudar, desde já eu agradeço. Atenciosamente. Valdir Lima
Certo e qual seria o valor apresentado no edit10.text ? Com o valor informado de 89,34?
Gostei + 0
25/11/2010
Valdir Lima
Gostei + 0
25/11/2010
Leonardo Xavier
Function TFCALCULO.LocalizarAngulo:Integer;
var
V, W :Double;
begin
V:=(StrToFloat(EditAngulo.Text));
W:=Trunc(V);
Edit10.Text:=FloatToStr(W);
if TabAnguloposte.locate('angulo',EDIT10.TEXT,[loCaseInsensitive]) then
begin
Edit11.Text:=TabAnguloposte.FieldByName('Pesoposte').AsFloat;
end;
end;
Gostei + 0
25/11/2010
Valdir Lima
Gostei + 0
25/11/2010
Leonardo Xavier
Valdir ja tentou utilizar o Round?
http://www.delphibasics.co.uk/RTL.asp?Name=Round&ExpandCode1=Yes
Gostei + 0
25/11/2010
Wilson Junior
var
V, W :Double;
begin
V := StrToFloat( EditAngulo.Text );
W := Round( V );
Edit10.Text := FloatToStr( W );
{ ... continue o seu código }
Espero ter colaborado.
Gostei + 0
25/11/2010
Valdir Lima
var
V, W :Double;
begin
V:=(StrToFloat(EditAngulo.Text));
W:=Round(V);
Edit10.Text:=FloatToStr(W);
if TabAnguloposte.locate('angulo',EDIT10.TEXT,[]) then
begin
Edit11.Text:=TabAnguloposte.FieldByName('Pesoposte').AsString;
end;
end; Tá difícil Valdir
Gostei + 0
25/11/2010
Valdir Lima
var
V, W :Double;
begin
V:=StrToFloat(EditAngulo.Text);
W:=Round(V);
Edit10.Text:=FloatToStr(W);
if TabAnguloposte.locate('angulo',EDIT10.TEXT,[]) then
begin
Edit11.Text:=TabAnguloposte.FieldByName('pesoposte).AsString;
end;
end; O sistema não está arredondando. Att. Valdir
Gostei + 0
25/11/2010
Wilson Junior
var
V, W :Double;
begin
V := StrToFloat( EditAngulo.Text );
ShowMessage( FloatToStr(V) );
W := Round( V );
Edit10.Text := FloatToStr( W );
{ ... continue o seu código }Verifique se está com ponto (89.34) ou vírgula (89,34) o seu EditAngulo, pois deve estar com ",".
Veja também se você não tem nenhum evento no Edit10 ou se mais algum lugar atribui dados ao Edit10.
Espero ter colaborado.
Gostei + 0
25/11/2010
Valdir Lima
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)