Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > Delphi: Для новичков > on key down error


Автор: muratboy31 13.2.2010, 20:25
whenever i try to type anything in dbedit4 i get error... i am trying to get percentage of a price...

Код

procedure TForm1.DBEdit4KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
var
percent:extended;
topltal:string;
begin
percent:=strtofloat(dbedit4.Text);
total:=floattostr(percent*2);
DBEdit5.text:=total;
end;

thanks for helps

Автор: Данкинг 13.2.2010, 20:50
topltal ain't equal to total. smile Furthermore,  maybe you need check the percentage at pressing <ENTER>? Thus, you should insert this line just after "begin:
Код

if key<>13 then exit;

Автор: muratboy31 13.2.2010, 23:03
can i not check the percentage with any numkey ???  with ever numkey down i want to c the percentage...

Автор: Данкинг 13.2.2010, 23:06
Цитата(muratboy31 @  13.2.2010,  23:03 Найти цитируемый пост)
can i not check the percentage with any numkey ???

Then what's the error you've got?

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)