Here is the code now:
procedure TForm1.Button1Click(Sender: TObject);
var j,r:integer; k:string;
begin
k := Edit1.Text;
if StrToInt(k) > 0 then
if StrToInt(k)<10 then
r := StrToInt(k);
if StrToInt(k) = 10 then
r := 1;
if StrToInt(k) > 10 then
if StrToInt(k) < 190 then
j:=StrToInt(k) mod 10;
r := j-1;
ShowMessage('Na toj poziciji se nalazi: '+ IntToStr(r));
end;
When I write k:=Edit1.Text option is not even suggested to use. Anybody got a solution?
TEditinstance to yourIntegervariable, you can useStrToIntfunction and specifyEdit.Text` as its argument.StrToInt(k)everywhere is not really a good idea. The conversion from string to integer takes time and doing it again and again will slow down your program (ok, not this trivial code, but it could become important in a larger project). Rather domyInt := StrToInt(k);once and then use that integer instead.