Editleri bimler hanesine ayırıp aynı anda matemetiksel işlem yapabilirsiniz. |
procedure TForm1.Edit1Change(Sender: TObject);
begin
if edit1.Text<>" then
begin
edit1.Text:=formatfloat('#,##',strtofloat(StringReplace(Edit1.Text,'.',",[rfreplaceall])));
edit1.SelStart :=length(edit1.text);
edit3.Text:=floattostr(strtofloat(StringReplace(Edit1.Text,'.',",[rfreplaceall]))+strtofloat(StringReplace(Edit2.Text,'.',",[rfreplaceall])));
edit3.Text:=formatfloat('#,##',strtofloat(StringReplace(Edit3.Text,'.',",[rfreplaceall])));
end;
end;
procedure TForm1.Edit2Change(Sender: TObject);
begin
if edit2.Text<>" then
begin
edit2.Text:=formatfloat('#,##',strtofloat(StringReplace(Edit2.Text,'.',",[rfreplaceall])));
edit2.SelStart :=length(edit1.text);
edit3.Text:=floattostr(strtofloat(StringReplace(Edit1.Text,'.',",[rfreplaceall]))+strtofloat(StringReplace(Edit2.Text,'.',",[rfreplaceall])));
edit3.Text:=formatfloat('#,##',strtofloat(StringReplace(Edit3.Text,'.',",[rfreplaceall])));
end;
end;
TD Software
Son yorumlar